Changeset 1415 in josm


Ignore:
Timestamp:
2009-02-16T15:14:34+01:00 (16 years ago)
Author:
stoecker
Message:

applied patch #2185 by bruce89

Location:
trunk/src/org/openstreetmap/josm
Files:
51 edited

Legend:

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

    r1232 r1415  
    33
    44import static org.openstreetmap.josm.tools.I18n.tr;
    5 import static org.openstreetmap.josm.tools.I18n.trn;
    65
    7 import java.awt.BorderLayout;
    86import java.awt.GridBagLayout;
    97import java.awt.event.ActionEvent;
    10 import java.awt.event.FocusAdapter;
    11 import java.awt.event.FocusEvent;
    128import java.awt.event.KeyEvent;
    13 import java.util.ArrayList;
    14 import java.util.Collection;
    15 import java.util.HashMap;
    16 import java.util.LinkedList;
    17 import java.util.List;
    18 import java.util.TreeMap;
    19 import java.util.TreeSet;
    209
    2110import javax.swing.JLabel;
     
    2615import org.openstreetmap.josm.Main;
    2716import org.openstreetmap.josm.command.AddCommand;
    28 import org.openstreetmap.josm.command.Command;
    29 import org.openstreetmap.josm.command.SequenceCommand;
    30 import org.openstreetmap.josm.data.osm.DataSet;
    31 import org.openstreetmap.josm.data.osm.Relation;
    3217import org.openstreetmap.josm.data.osm.Node;
    33 import org.openstreetmap.josm.data.osm.OsmPrimitive;
    34 import org.openstreetmap.josm.data.osm.RelationMember;
    35 import org.openstreetmap.josm.data.osm.Way;
    36 import org.openstreetmap.josm.data.coor.EastNorth;
    3718import org.openstreetmap.josm.data.coor.LatLon;
    38 import org.openstreetmap.josm.tools.AutoCompleteComboBox;
    3919import org.openstreetmap.josm.tools.GBC;
    4020import org.openstreetmap.josm.tools.Shortcut;
  • trunk/src/org/openstreetmap/josm/actions/AlignInCircleAction.java

    r1169 r1415  
    6060                }
    6161            }
    62             result += mat[0][i] * Math.pow(-1, (double) i) * determinant(temp);
     62            result += mat[0][i] * Math.pow(-1, i) * determinant(temp);
    6363        }
    6464        return result;
     
    136136        Collection<Way> ways = new LinkedList<Way>();
    137137        Node center = null;
    138         Node node = null;
    139138        double radius = 0;
    140139        boolean regular = false;
     
    161160            // distance between two nodes.
    162161            if (nodes.size() > 0) {
    163                 if (nodes.size() == 1 && way.nodes.contains((Node) nodes.toArray()[0])) {
    164                     node = (Node) nodes.toArray()[0];
     162                if (nodes.size() == 1 && way.nodes.contains(nodes.toArray()[0])) {
    165163                    regular = true;
    166164                } else {
    167165
    168                     center = (Node) nodes.toArray()[way.nodes.contains((Node) nodes.toArray()[0]) ? 1 : 0];
     166                    center = (Node) nodes.toArray()[way.nodes.contains(nodes.toArray()[0]) ? 1 : 0];
    169167                    if (nodes.size() == 2)
    170168                        radius = distance(((Node) nodes.toArray()[0]).eastNorth, ((Node) nodes.toArray()[1]).eastNorth);
  • trunk/src/org/openstreetmap/josm/actions/DiskAccessAction.java

    r1397 r1415  
    77
    88import javax.swing.JFileChooser;
    9 import javax.swing.JOptionPane;
    10 
    119import org.openstreetmap.josm.Main;
    1210import org.openstreetmap.josm.gui.ExtendedDialog;
  • trunk/src/org/openstreetmap/josm/actions/DuplicateAction.java

    r1351 r1415  
    99import java.util.Collection;
    1010
    11 import org.openstreetmap.josm.Main;
    1211import org.openstreetmap.josm.actions.CopyAction;
    1312import org.openstreetmap.josm.actions.PasteAction;
  • trunk/src/org/openstreetmap/josm/actions/JosmAction.java

    r1335 r1415  
    44import static org.openstreetmap.josm.tools.I18n.tr;
    55
    6 import java.awt.event.InputEvent;
    7 
    86import javax.swing.AbstractAction;
    97import javax.swing.JComponent;
    10 import javax.swing.KeyStroke;
    118
    129import org.openstreetmap.josm.Main;
  • trunk/src/org/openstreetmap/josm/actions/OpenLocationAction.java

    r1397 r1415  
    77import java.awt.event.ActionEvent;
    88import java.awt.event.KeyEvent;
    9 import java.io.InputStream;
    10 import java.io.File;
    11 import java.io.FileInputStream;
    12 import java.io.FileNotFoundException;
    13 import java.io.IOException;
    14 import java.util.zip.GZIPInputStream;
    159
    1610import javax.swing.JCheckBox;
    17 import javax.swing.JFileChooser;
    1811import javax.swing.JLabel;
    19 import javax.swing.JOptionPane;
    2012import javax.swing.JPanel;
    2113import javax.swing.JTextField;
     
    2315import org.openstreetmap.josm.Main;
    2416import org.openstreetmap.josm.actions.downloadtasks.DownloadOsmTask;
    25 import org.openstreetmap.josm.data.osm.DataSet;
    2617import org.openstreetmap.josm.gui.ExtendedDialog;
    27 import org.openstreetmap.josm.gui.layer.GpxLayer;
    28 import org.openstreetmap.josm.gui.layer.OsmDataLayer;
    29 import org.openstreetmap.josm.gui.layer.markerlayer.MarkerLayer;
    30 import org.openstreetmap.josm.io.GpxReader;
    31 import org.openstreetmap.josm.io.NmeaReader;
    32 import org.openstreetmap.josm.io.OsmReader;
    33 import org.openstreetmap.josm.io.OsmServerLocationReader;
    34 import org.xml.sax.SAXException;
    3518import org.openstreetmap.josm.tools.GBC;
    3619import org.openstreetmap.josm.tools.Shortcut;
  • trunk/src/org/openstreetmap/josm/actions/OrthogonalizeAction.java

    r1280 r1415  
    55import static org.openstreetmap.josm.tools.I18n.tr;
    66
    7 import java.awt.List;
    87import java.awt.event.ActionEvent;
    98import java.awt.event.KeyEvent;
     
    1514
    1615import org.openstreetmap.josm.Main;
    17 import org.openstreetmap.josm.command.AddCommand;
    1816import org.openstreetmap.josm.command.Command;
    1917import org.openstreetmap.josm.command.MoveCommand;
  • trunk/src/org/openstreetmap/josm/actions/SplitWayAction.java

    r1252 r1415  
    123123                if (entry.getValue().equals(selectedNodes.size())) {
    124124                    if (selectedWay != null) {
    125                         JOptionPane.showMessageDialog(Main.parent, tr("There is more than one way using the node(s) you selected. Please select the way also."));
     125                        JOptionPane.showMessageDialog(Main.parent,
     126                        trn("There is more than one way using the node you selected. Please select the way also.",
     127                        "There is more than one way using the nodes you selected. Please select the way also.",
     128                        selectedNodes.size()));
    126129                        return;
    127130                    }
     
    131134
    132135            if (selectedWay == null) {
    133                 JOptionPane.showMessageDialog(Main.parent, tr("The selected nodes do not share the same way."));
     136                JOptionPane.showMessageDialog(Main.parent,
     137                tr("The selected nodes do not share the same way."));
    134138                return;
    135139            }
     
    144148            if (!nds.isEmpty()) {
    145149                JOptionPane.showMessageDialog(Main.parent,
    146                         trn("The selected way does not contain the selected node.",
    147                                 "The selected way does not contain all the selected nodes.", selectedNodes.size()));
     150                trn("The selected way does not contain the selected node.",
     151                "The selected way does not contain all the selected nodes.",
     152                selectedNodes.size()));
    148153                return;
    149154            }
  • trunk/src/org/openstreetmap/josm/actions/downloadtasks/DownloadGpsTask.java

    r1396 r1415  
    1515import org.openstreetmap.josm.gui.layer.GpxLayer;
    1616import org.openstreetmap.josm.data.gpx.GpxData;
    17 import org.openstreetmap.josm.data.Bounds;
    1817import org.openstreetmap.josm.io.BoundingBoxDownloader;
    1918import org.xml.sax.SAXException;
     
    3938            if (rawData == null)
    4039                return;
    41                         rawData.recalculateBounds();
    42                         Bounds b = rawData.bounds;
    43                         String name = tr("Downloaded GPX Data");
    44                         GpxLayer layer = new GpxLayer(rawData, name);
     40            rawData.recalculateBounds();
     41            String name = tr("Downloaded GPX Data");
     42            GpxLayer layer = new GpxLayer(rawData, name);
    4543            Layer x = findMergeLayer();
    4644            if (newLayer || x == null)
  • trunk/src/org/openstreetmap/josm/actions/mapmode/DeleteAction.java

    r1379 r1415  
    2525 * The user can click on an object, which gets deleted if possible. When Ctrl is
    2626 * pressed when releasing the button, the objects and all its references are
    27  * deleted. The exact definition of "all its references" are in
    28  * {@link #deleteWithReferences deleteWithReferences}.
     27 * deleted.
    2928 *
    3029 * If the user did not press Ctrl and the object has any references, the user
  • trunk/src/org/openstreetmap/josm/command/DeleteCommand.java

    r1397 r1415  
    129129    }
    130130
    131     /**
    132      * Try to delete all given primitives.
    133      *
    134      * If a node is used by a way, it's removed from that way. If a node or a way is used by a
    135      * relation, inform the user and do not delete.
    136      *
    137      * If this would cause ways with less than 2 nodes to be created, delete these ways instead. If
    138      * they are part of a relation, inform the user and do not delete.
    139      *
    140      * @param selection The objects to delete.
    141      * @param alsoDeleteNodesInWay <code>true</code> if nodes should be deleted as well
    142      * @return command A command to perform the deletions, or null of there is nothing to delete.
    143      */
    144131    private static int testRelation(Relation ref, OsmPrimitive osm) {
    145132        NameVisitor n = new NameVisitor();
     
    175162    }
    176163
     164    /**
     165     * Try to delete all given primitives.
     166     *
     167     * If a node is used by a way, it's removed from that way. If a node or a way is used by a
     168     * relation, inform the user and do not delete.
     169     *
     170     * If this would cause ways with less than 2 nodes to be created, delete these ways instead. If
     171     * they are part of a relation, inform the user and do not delete.
     172     *
     173     * @param selection The objects to delete.
     174     * @param alsoDeleteNodesInWay <code>true</code> if nodes should be deleted as well
     175     * @return command A command to perform the deletions, or null of there is nothing to delete.
     176     */
    177177    public static Command delete(Collection<? extends OsmPrimitive> selection, boolean alsoDeleteNodesInWay) {
    178178        if (selection.isEmpty())
  • trunk/src/org/openstreetmap/josm/data/osm/DataSet.java

    r1398 r1415  
    55import java.util.Arrays;
    66import java.util.Collection;
    7 import java.util.Collections;
    87import java.util.Comparator;
    98import java.util.HashSet;
  • trunk/src/org/openstreetmap/josm/data/osm/Node.java

    r1200 r1415  
    33
    44import static org.openstreetmap.josm.tools.I18n.tr;
    5 import java.text.DecimalFormat;
    6 import java.text.NumberFormat;
    75
    86import org.openstreetmap.josm.Main;
  • trunk/src/org/openstreetmap/josm/data/osm/visitor/BoundingXYVisitor.java

    r1226 r1415  
    6565     * If the bounding box has not been set (<code>min</code> or <code>max</code>
    6666     * equal <code>null</code>) this method does not do anything.
    67      *
    68      * @param enlargeDegree
    6967     */
    7068    public void enlargeBoundingBox() {
  • trunk/src/org/openstreetmap/josm/data/osm/visitor/MapPaintVisitor.java

    r1411 r1415  
    1 // License: GPL. Copyright 2007 by Immanuel Scholz and others
     1/* License: GPL. Copyright 2007 by Immanuel Scholz and others */
    22package org.openstreetmap.josm.data.osm.visitor;
     3
     4/* To enable debugging or profiling remove the double / signs */
    35
    46import static org.openstreetmap.josm.tools.I18n.marktr;
     
    4749    protected boolean drawRestriction;
    4850    protected boolean leftHandTraffic;
    49     protected boolean restrictionDebug;
     51    //protected boolean restrictionDebug;
    5052    protected int showNames;
    5153    protected int showIcons;
     
    7072    private EastNorth maxEN;
    7173
    72     protected int profilerVisibleNodes;
    73     protected int profilerVisibleWays;
    74     protected int profilerVisibleAreas;
    75     protected int profilerSegments;
    76     protected int profilerVisibleSegments;
    77     protected boolean profilerOmitDraw;
     74    //protected int profilerVisibleNodes;
     75    //protected int profilerVisibleWays;
     76    //protected int profilerVisibleAreas;
     77    //protected int profilerSegments;
     78    //protected int profilerVisibleSegments;
     79    //protected boolean profilerOmitDraw;
    7880
    7981    protected boolean isZoomOk(ElemStyle e) {
     
    8486            return (circum < 1500);
    8587
    86         // formula to calculate a map scale: natural size / map size = scale
    87         // example: 876000mm (876m as displayed) / 22mm (roughly estimated screen size of legend bar) = 39818
    88         //
    89         // so the exact "correcting value" below depends only on the screen size and resolution
    90         // XXX - do we need a Preference setting for this (if things vary widely)?
     88        /* formula to calculate a map scale: natural size / map size = scale
     89          example: 876000mm (876m as displayed) / 22mm (roughly estimated screen size of legend bar) = 39818
     90
     91          so the exact "correcting value" below depends only on the screen size and resolution
     92           XXX - do we need a Preference setting for this (if things vary widely)? */
    9193        return !(circum >= e.maxScale / 22 || circum < e.minScale / 22);
    9294    }
     
    132134     */
    133135    public void visit(Node n) {
    134         // check, if the node is visible at all
     136        /* check, if the node is visible at all */
    135137        if((n.eastNorth.east()  > maxEN.east() ) ||
    136138           (n.eastNorth.north() > maxEN.north()) ||
     
    145147        IconElemStyle nodeStyle = (IconElemStyle)getPrimitiveStyle(n);
    146148
    147         if(profilerOmitDraw)
    148             return;
     149        //if(profilerOmitDraw)
     150        //    return;
    149151
    150152        if (nodeStyle != null && isZoomOk(nodeStyle) && showIcons > dist)
     
    171173        }
    172174
    173         // check, if the way is visible at all
     175        /* check, if the way is visible at all */
    174176        double minx = 10000;
    175177        double maxx = -10000;
     
    208210        if(wayStyle==null)
    209211        {
    210             // way without style
    211             profilerVisibleWays++;
    212             if(!profilerOmitDraw)
    213                 drawWay(w, null, untaggedColor, w.selected);
     212            /* way without style */
     213            //profilerVisibleWays++;
     214            //if(!profilerOmitDraw)
     215            drawWay(w, null, untaggedColor, w.selected);
    214216        }
    215217        else if(wayStyle instanceof LineElemStyle)
    216218        {
    217             // way with line style
    218             profilerVisibleWays++;
    219             if(!profilerOmitDraw)
    220                 drawWay(w, (LineElemStyle)wayStyle, untaggedColor, w.selected);
     219            /* way with line style */
     220            //profilerVisibleWays++;
     221            //if(!profilerOmitDraw)
     222            drawWay(w, (LineElemStyle)wayStyle, untaggedColor, w.selected);
    221223        }
    222224        else if (wayStyle instanceof AreaElemStyle)
    223225        {
    224             // way with area style
    225             if(!profilerOmitDraw)
    226             {
    227                 if (fillAreas > dist)
    228                 {
    229                     profilerVisibleAreas++;
    230                     drawArea(w, w.selected ? selectedColor : ((AreaElemStyle)wayStyle).color);
    231                     if(!w.isClosed())
    232                         w.putError(tr("Area style way is not closed."), true);
    233                 }
    234                 drawWay(w, ((AreaElemStyle)wayStyle).line, ((AreaElemStyle)wayStyle).color, w.selected);
    235             }
     226            /* way with area style */
     227            //if(!profilerOmitDraw)
     228            //{
     229            if (fillAreas > dist)
     230            {
     231            //    profilerVisibleAreas++;
     232                drawArea(w, w.selected ? selectedColor : ((AreaElemStyle)wayStyle).color);
     233                if(!w.isClosed())
     234                    w.putError(tr("Area style way is not closed."), true);
     235            }
     236            drawWay(w, ((AreaElemStyle)wayStyle).line, ((AreaElemStyle)wayStyle).color, w.selected);
     237            //}
    236238        }
    237239    }
    238240
    239241    public void drawWay(Way w, LineElemStyle l, Color color, Boolean selected) {
    240         // show direction arrows, if draw.segment.relevant_directions_only is not set,
    241         // the way is tagged with a direction key
    242         // (even if the tag is negated as in oneway=false) or the way is selected
     242        /* show direction arrows, if draw.segment.relevant_directions_only is not set,
     243          the way is tagged with a direction key
     244           (even if the tag is negated as in oneway=false) or the way is selected */
    243245        boolean showDirection = w.selected || ((!useRealWidth) && (showDirectionArrow
    244246        && (!showRelevantDirectionsOnly || w.hasDirectionKeys)));
    245         // head only takes over control if the option is true,
    246         // the direction should be shown at all and not only because it's selected
     247        /* head only takes over control if the option is true,
     248           the direction should be shown at all and not only because it's selected */
    247249        boolean showOnlyHeadArrowOnly = showDirection && !w.selected && showHeadArrowOnly;
    248250        int width = defaultSegmentWidth;
    249         int realWidth = 0; //the real width of the element in meters
     251        int realWidth = 0; /* the real width of the element in meters */
    250252        int dashed = 0;
    251253        Color dashedColor = null;
     
    273275            color = selectedColor;
    274276
    275         // draw overlays under the way
     277        /* draw overlays under the way */
    276278        if(l != null && l.overlays != null)
    277279        {
     
    294296        }
    295297
    296         // draw the way
     298        /* draw the way */
    297299        lastN = null;
    298300        Iterator<Node> it = w.nodes.iterator();
     
    306308        }
    307309
    308         // draw overlays above the way
     310        /* draw overlays above the way */
    309311        if(l != null && l.overlays != null)
    310312        {
     
    392394                                if(c.selected) selected = true;
    393395                                --left;
    394                                 if(n == null) n = new ArrayList(w.nodes);
     396                                if(n == null) n = new ArrayList<Node>(w.nodes);
    395397                                n.remove((mode == 21 || mode == 22) ? nl : 0);
    396398                                if(mode == 21)
     
    466468        r.mappaintVisibleCode = 0;
    467469
    468         // TODO: is it possible to do this like the nodes/ways code?
    469         if(profilerOmitDraw)
    470             return;
     470        /* TODO: is it possible to do this like the nodes/ways code? */
     471        //if(profilerOmitDraw)
     472        //    return;
    471473
    472474        if(selectedCall)
     
    506508    }
    507509
    508     // this current experimental implementation will only work for standard restrictions:
    509     // from(Way) / via(Node) / to(Way)
     510    /* this current experimental implementation will only work for standard restrictions:
     511       from(Way) / via(Node) / to(Way) */
    510512    public void drawRestriction(Relation r) {
    511         if(restrictionDebug)
    512             System.out.println("Restriction: " + r.keys.get("name") + " restriction " + r.keys.get("restriction"));
     513        //if(restrictionDebug)
     514        //    System.out.println("Restriction: " + r.keys.get("name") + " restriction " + r.keys.get("restriction"));
    513515
    514516        r.clearErrors();
     
    518520        Node via = null;
    519521
    520         // find the "from", "via" and "to" elements
     522        /* find the "from", "via" and "to" elements */
    521523        for (RelationMember m : r.members)
    522524        {
    523             if(restrictionDebug)
    524                 System.out.println("member " + m.member + " selected " + r.selected);
     525            //if(restrictionDebug)
     526            //    System.out.println("member " + m.member + " selected " + r.selected);
    525527
    526528            if(m.member == null)
     
    538540                {
    539541                    Way w = (Way) m.member;
    540                     ElemStyle style = getPrimitiveStyle(w);
    541                     //if(r.selected) {
    542                     //    drawWay(w, null /*(LineElemStyle)style*/, selectedColor, true);
    543                     //    w.mappaintDrawnCode = paintid;
    544                     //}
    545542                    if(w.nodes.size() < 2)
    546543                    {
     
    594591        }
    595592
    596         // check if "from" way starts or ends at via
     593        /* check if "from" way starts or ends at via */
    597594        if(fromWay.nodes.get(0) != via && fromWay.nodes.get(fromWay.nodes.size()-1) != via) {
    598595            r.putError(tr("The \"from\" way doesn't start or end at a \"via\" node."), true);
    599596            return;
    600597        }
    601         // check if "to" way starts or ends at via
     598        /* check if "to" way starts or ends at via */
    602599        /*if(toWay.nodes.get(0) != via && toWay.nodes.get(toWay.nodes.size()-1) != via) {
    603600            r.putError(tr("to way doesn't start or end at a via node"), true);
    604             //return;
     601            return;
    605602        }*/
    606603
    607         // find the "direct" nodes before the via node
     604        /* find the "direct" nodes before the via node */
    608605        Node fromNode = null;
    609606        try
     
    620617        }
    621618
    622         // find the "direct" node after the via node
     619        /* find the "direct" node after the via node */
    623620        Node toNode = null;
    624621        try
    625622        {
    626623            if(toWay.nodes.get(0) == via) {
    627                 if(restrictionDebug)
    628                     System.out.println("To way heading away from via");
     624                //if(restrictionDebug)
     625                //    System.out.println("To way heading away from via");
    629626                toNode = toWay.nodes.get(1);
    630627            } else {
    631                 if(restrictionDebug)
    632                     System.out.println("To way heading towards via");
     628                //if(restrictionDebug)
     629                //    System.out.println("To way heading towards via");
    633630                toNode = toWay.nodes.get(toWay.nodes.size()-2);
    634631            }
     
    640637        Point pVia = nc.getPoint(via.eastNorth);
    641638
    642         if(restrictionDebug) {
    643             Point pTo = nc.getPoint(toNode.eastNorth);
    644 
    645             // debug output of interesting nodes
    646             System.out.println("From: " + fromNode);
    647             drawNode(fromNode, selectedColor, selectedNodeSize, selectedNodeRadius, fillSelectedNode);
    648             System.out.println("Via: " + via);
    649             drawNode(via, selectedColor, selectedNodeSize, selectedNodeRadius, fillSelectedNode);
    650             System.out.println("To: " + toNode);
    651             drawNode(toNode, selectedColor, selectedNodeSize, selectedNodeRadius, fillSelectedNode);
    652             System.out.println("From X: " + pFrom.x + " Y " + pFrom.y);
    653             System.out.println("Via  X: " + pVia.x  + " Y " + pVia.y);
    654             System.out.println("To   X: " + pTo.x   + " Y " + pTo.y);
    655         }
    656 
    657         // starting from via, go back the "from" way a few pixels
    658         // (calculate the vector vx/vy with the specified length and the direction away from the "via" node along the first segment of the "from" way)
     639        //if(restrictionDebug) {
     640        //    Point pTo = nc.getPoint(toNode.eastNorth);
     641
     642        //    /* debug output of interesting nodes */
     643        //    System.out.println("From: " + fromNode);
     644        //    drawNode(fromNode, selectedColor, selectedNodeSize, selectedNodeRadius, fillSelectedNode);
     645        //    System.out.println("Via: " + via);
     646        //    drawNode(via, selectedColor, selectedNodeSize, selectedNodeRadius, fillSelectedNode);
     647        //    System.out.println("To: " + toNode);
     648        //    drawNode(toNode, selectedColor, selectedNodeSize, selectedNodeRadius, fillSelectedNode);
     649        //    System.out.println("From X: " + pFrom.x + " Y " + pFrom.y);
     650        //    System.out.println("Via  X: " + pVia.x  + " Y " + pVia.y);
     651        //    System.out.println("To   X: " + pTo.x   + " Y " + pTo.y);
     652        //}
     653
     654        /* starting from via, go back the "from" way a few pixels
     655           (calculate the vector vx/vy with the specified length and the direction
     656           away from the "via" node along the first segment of the "from" way)
     657        */
    659658        double distanceFromVia=14;
    660659        double dx = (pFrom.x >= pVia.x) ? (pFrom.x - pVia.x) : (pVia.x - pFrom.x);
     
    675674        if(pFrom.y < pVia.y) vy = -vy;
    676675
    677         if(restrictionDebug)
    678             System.out.println("vx " + vx + " vy " + vy);
    679 
    680         // go a few pixels away from the way (in a right angle)
    681         // (calculate the vx2/vy2 vector with the specified length and the direction 90degrees away from the first segment of the "from" way)
     676        //if(restrictionDebug)
     677        //    System.out.println("vx " + vx + " vy " + vy);
     678
     679        /* go a few pixels away from the way (in a right angle)
     680           (calculate the vx2/vy2 vector with the specified length and the direction
     681           90degrees away from the first segment of the "from" way)
     682        */
    682683        double distanceFromWay=8;
    683684        double vx2 = 0;
     
    733734        }
    734735
    735         // rotate icon with direction last node in from to
    736         if(restrictionDebug)
    737             System.out.println("Deg1 " + fromAngleDeg + " Deg2 " + (fromAngleDeg + 180) + " Icon " + iconAngle);
     736        /* rotate icon with direction last node in from to */
     737        //if(restrictionDebug)
     738        //    System.out.println("Deg1 " + fromAngleDeg + " Deg2 " + (fromAngleDeg + 180) + " Icon " + iconAngle);
    738739        ImageIcon rotatedIcon = ImageProvider.createRotatedImage(null /*icon2*/, nodeStyle.icon, iconAngle);
    739740
    740         // scale down icon to 16*16 pixels
     741        /* scale down icon to 16*16 pixels */
    741742        ImageIcon smallIcon = new ImageIcon(rotatedIcon.getImage().getScaledInstance(16 , 16, Image.SCALE_SMOOTH));
    742743        int w = smallIcon.getIconWidth(), h=smallIcon.getIconHeight();
     
    10411042        Polygon polygon = getPolygon(w);
    10421043
    1043         // set the opacity (alpha) level of the filled polygon
     1044        /* set the opacity (alpha) level of the filled polygon */
    10441045        g.setColor(new Color(color.getRed(), color.getGreen(), color.getBlue(), fillAlpha));
    10451046        g.fillPolygon(polygon);
     
    10481049    protected void drawAreaPolygon(Polygon polygon, Color color)
    10491050    {
    1050         // set the opacity (alpha) level of the filled polygon
     1051        /* set the opacity (alpha) level of the filled polygon */
    10511052        g.setColor(new Color(color.getRed(), color.getGreen(), color.getBlue(), fillAlpha));
    10521053        g.fillPolygon(polygon);
     
    10571058        if ((p.x < 0) || (p.y < 0) || (p.x > nc.getWidth()) || (p.y > nc.getHeight())) return;
    10581059
    1059         profilerVisibleNodes++;
     1060        //profilerVisibleNodes++;
    10601061
    10611062        int w = icon.getIconWidth(), h=icon.getIconHeight();
     
    10921093
    10931094    private void drawSeg(Node n1, Node n2, Color col, boolean showDirection, int width, int dashed, Color dashedColor) {
    1094         profilerSegments++;
     1095        //profilerSegments++;
    10951096        if (col != currentColor || width != currentWidth || dashed != currentDashed || dashedColor != currentDashedColor) {
    10961097            displaySegments(col, width, dashed, dashedColor);
     
    11021103            return;
    11031104        }
    1104         profilerVisibleSegments++;
     1105        //profilerVisibleSegments++;
    11051106        currentPath.moveTo(p1.x, p1.y);
    11061107        currentPath.lineTo(p2.x, p2.y);
     
    11661167                return;
    11671168
    1168             profilerVisibleNodes++;
     1169            //profilerVisibleNodes++;
    11691170
    11701171            g.setColor(color);
     
    11971198    }
    11981199
    1199     // Shows areas before non-areas
     1200    /* Shows areas before non-areas */
    12001201    public void visitAll(DataSet data, Boolean virtual) {
    12011202
    1202         boolean profiler = Main.pref.getBoolean("mappaint.profiler",false);
    1203         profilerOmitDraw = Main.pref.getBoolean("mappaint.profiler.omitdraw",false);
     1203        //boolean profiler = Main.pref.getBoolean("mappaint.profiler",false);
     1204        //profilerOmitDraw = Main.pref.getBoolean("mappaint.profiler.omitdraw",false);
    12041205
    12051206        useStyleCache = Main.pref.getBoolean("mappaint.cache",true);
     
    12131214        dist = ll1.greatCircleDistance(ll2);
    12141215
    1215         long profilerStart = java.lang.System.currentTimeMillis();
    1216         long profilerLast = profilerStart;
    1217         int profilerN;
    1218         if(profiler)
    1219             System.out.println("Mappaint Profiler (" +
    1220                 (useStyleCache ? "cache=true, " : "cache=false, ") +
    1221                 "fillareas " + fillAreas + ", " +
    1222                 "fillalpha=" + fillAlpha + "%, " +
    1223                 "dist=" + (int)dist + "m)");
     1216        //long profilerStart = java.lang.System.currentTimeMillis();
     1217        //long profilerLast = profilerStart;
     1218        //int profilerN;
     1219        //if(profiler)
     1220        //    System.out.println("Mappaint Profiler (" +
     1221        //        (useStyleCache ? "cache=true, " : "cache=false, ") +
     1222        //        "fillareas " + fillAreas + ", " +
     1223        //        "fillalpha=" + fillAlpha + "%, " +
     1224        //        "dist=" + (int)dist + "m)");
    12241225
    12251226        getSettings(virtual);
    12261227        useRealWidth = Main.pref.getBoolean("mappaint.useRealWidth",false);
    12271228        zoomLevelDisplay = Main.pref.getBoolean("mappaint.zoomLevelDisplay",false);
    1228         circum = Main.map.mapView.getScale()*100*Main.proj.scaleFactor()*40041455; // circumference of the earth in meter
     1229        circum = Main.map.mapView.getScale()*100*Main.proj.scaleFactor()*40041455; /* circumference of the earth in meter */
    12291230        styles = MapPaintStyles.getStyles().getStyleSet();
    12301231        drawMultipolygon = Main.pref.getBoolean("mappaint.multipolygon",true);
    12311232        drawRestriction = Main.pref.getBoolean("mappaint.restriction",true);
    1232         restrictionDebug = Main.pref.getBoolean("mappaint.restriction.debug",false);
     1233        //restrictionDebug = Main.pref.getBoolean("mappaint.restriction.debug",false);
    12331234        leftHandTraffic = Main.pref.getBoolean("mappaint.lefthandtraffic",false);
    12341235        orderFont = new Font(Main.pref.get("mappaint.font","Helvetica"), Font.PLAIN, Main.pref.getInteger("mappaint.fontsize", 8));
     
    12431244        viewid = nc.getViewID();
    12441245
    1245         profilerVisibleNodes = 0;
    1246         profilerVisibleWays = 0;
    1247         profilerVisibleAreas = 0;
    1248         profilerSegments = 0;
    1249         profilerVisibleSegments = 0;
    1250 
    1251         if(profiler)
    1252         {
    1253             System.out.format("Prepare  : %5dms\n", (java.lang.System.currentTimeMillis()-profilerLast));
    1254             profilerLast = java.lang.System.currentTimeMillis();
    1255         }
     1246        //profilerVisibleNodes = 0;
     1247        //profilerVisibleWays = 0;
     1248        //profilerVisibleAreas = 0;
     1249        //profilerSegments = 0;
     1250        //profilerVisibleSegments = 0;
     1251
     1252        //if(profiler)
     1253        //{
     1254        //    System.out.format("Prepare  : %5dms\n", (java.lang.System.currentTimeMillis()-profilerLast));
     1255        //    profilerLast = java.lang.System.currentTimeMillis();
     1256        //}
    12561257
    12571258        if (fillAreas > dist && styles != null && styles.hasAreas()) {
     
    12591260
    12601261            /*** RELATIONS ***/
    1261             profilerN = 0;
     1262        //    profilerN = 0;
    12621263            for (final Relation osm : data.relations)
    12631264            {
     
    12651266                {
    12661267                    osm.visit(this);
    1267                     profilerN++;
    1268                 }
    1269             }
    1270 
    1271             if(profiler)
    1272             {
    1273                 System.out.format("Relations: %5dms, calls=%7d\n", (java.lang.System.currentTimeMillis()-profilerLast), profilerN);
    1274                 profilerLast = java.lang.System.currentTimeMillis();
    1275             }
     1268        //            profilerN++;
     1269                }
     1270            }
     1271
     1272        //    if(profiler)
     1273        //    {
     1274        //        System.out.format("Relations: %5dms, calls=%7d\n", (java.lang.System.currentTimeMillis()-profilerLast), profilerN);
     1275        //        profilerLast = java.lang.System.currentTimeMillis();
     1276        //    }
    12761277
    12771278            /*** AREAS ***/
    1278             profilerN = 0;
     1279        //    profilerN = 0;
    12791280            for (final Way osm : data.ways)
    12801281            {
     
    12851286                    {
    12861287                        osm.visit(this);
    1287                         profilerN++;
     1288        //                profilerN++;
    12881289                    } else
    1289                         noAreaWays.add((Way)osm);
    1290                 }
    1291             }
    1292 
    1293             if(profiler)
    1294             {
    1295                 System.out.format("Areas    : %5dms, calls=%7d, visible=%d\n",
    1296                     (java.lang.System.currentTimeMillis()-profilerLast), profilerN, profilerVisibleAreas);
    1297                 profilerLast = java.lang.System.currentTimeMillis();
    1298             }
     1290                        noAreaWays.add(osm);
     1291                }
     1292            }
     1293
     1294        //    if(profiler)
     1295        //    {
     1296        //        System.out.format("Areas    : %5dms, calls=%7d, visible=%d\n",
     1297        //            (java.lang.System.currentTimeMillis()-profilerLast), profilerN, profilerVisibleAreas);
     1298        //        profilerLast = java.lang.System.currentTimeMillis();
     1299        //    }
    12991300
    13001301            /*** WAYS ***/
    1301             profilerN = 0;
     1302        //    profilerN = 0;
    13021303            fillAreas = 0;
    13031304            for (final OsmPrimitive osm : noAreaWays)
    13041305            {
    13051306                osm.visit(this);
    1306                 profilerN++;
    1307             }
    1308 
    1309             if(profiler)
    1310             {
    1311                 System.out.format("Ways     : %5dms, calls=%7d, visible=%d\n",
    1312                     (java.lang.System.currentTimeMillis()-profilerLast), profilerN, profilerVisibleWays);
    1313                 profilerLast = java.lang.System.currentTimeMillis();
    1314             }
     1307        //        profilerN++;
     1308            }
     1309
     1310        //    if(profiler)
     1311        //    {
     1312        //        System.out.format("Ways     : %5dms, calls=%7d, visible=%d\n",
     1313        //            (java.lang.System.currentTimeMillis()-profilerLast), profilerN, profilerVisibleWays);
     1314        //        profilerLast = java.lang.System.currentTimeMillis();
     1315        //    }
    13151316        }
    13161317        else
    13171318        {
    13181319            /*** WAYS (filling disabled)  ***/
    1319             profilerN = 0;
     1320        //    profilerN = 0;
    13201321            for (final OsmPrimitive osm : data.ways)
    13211322                if (!osm.incomplete && !osm.deleted && !osm.selected
     
    13231324                {
    13241325                    osm.visit(this);
    1325                     profilerN++;
    1326                 }
    1327 
    1328             if(profiler)
    1329             {
    1330                 System.out.format("Ways     : %5dms, calls=%7d, visible=%d\n",
    1331                     (java.lang.System.currentTimeMillis()-profilerLast), profilerN, profilerVisibleWays);
    1332                 profilerLast = java.lang.System.currentTimeMillis();
    1333             }
     1326        //            profilerN++;
     1327                }
     1328
     1329        //    if(profiler)
     1330        //    {
     1331        //        System.out.format("Ways     : %5dms, calls=%7d, visible=%d\n",
     1332        //            (java.lang.System.currentTimeMillis()-profilerLast), profilerN, profilerVisibleWays);
     1333        //        profilerLast = java.lang.System.currentTimeMillis();
     1334        //    }
    13341335        }
    13351336
    13361337        /*** SELECTED  ***/
    13371338        selectedCall = true;
    1338         profilerN = 0;
     1339        //profilerN = 0;
    13391340        for (final OsmPrimitive osm : data.getSelected()) {
    13401341            if (!osm.incomplete && !osm.deleted && !(osm instanceof Node)
     
    13421343            {
    13431344                osm.visit(this);
    1344                 profilerN++;
    1345             }
    1346         }
    1347 
    1348         if(profiler)
    1349         {
    1350             System.out.format("Selected : %5dms, calls=%7d\n", (java.lang.System.currentTimeMillis()-profilerLast), profilerN);
    1351             profilerLast = java.lang.System.currentTimeMillis();
    1352         }
     1345        //        profilerN++;
     1346            }
     1347        }
     1348
     1349        //if(profiler)
     1350        //{
     1351        //    System.out.format("Selected : %5dms, calls=%7d\n", (java.lang.System.currentTimeMillis()-profilerLast), profilerN);
     1352        //    profilerLast = java.lang.System.currentTimeMillis();
     1353        //}
    13531354
    13541355        /*** DISPLAY CACHED SEGMENTS (WAYS) NOW ***/
     
    13561357
    13571358        /*** NODES ***/
    1358         profilerN = 0;
     1359        //profilerN = 0;
    13591360        for (final OsmPrimitive osm : data.nodes)
    13601361            if (!osm.incomplete && !osm.deleted
     
    13621363            {
    13631364                osm.visit(this);
    1364                 profilerN++;
    1365             }
    1366 
    1367         if(profiler)
    1368         {
    1369             System.out.format("Nodes    : %5dms, calls=%7d, visible=%d\n",
    1370                 (java.lang.System.currentTimeMillis()-profilerLast), profilerN, profilerVisibleNodes);
    1371             profilerLast = java.lang.System.currentTimeMillis();
    1372         }
     1365        //        profilerN++;
     1366            }
     1367
     1368        //if(profiler)
     1369        //{
     1370        //    System.out.format("Nodes    : %5dms, calls=%7d, visible=%d\n",
     1371        //        (java.lang.System.currentTimeMillis()-profilerLast), profilerN, profilerVisibleNodes);
     1372        //    profilerLast = java.lang.System.currentTimeMillis();
     1373        //}
    13731374
    13741375        /*** VIRTUAL  ***/
    13751376        if (virtualNodeSize != 0)
    13761377        {
    1377             profilerN = 0;
     1378        //    profilerN = 0;
    13781379            currentColor = nodeColor;
    13791380            for (final OsmPrimitive osm : data.ways)
     
    13811382                && osm.mappaintVisibleCode != viewid )
    13821383                {
    1383                     // TODO: move this into the SimplePaint code?
    1384                     if(!profilerOmitDraw)
     1384                    /* TODO: move this into the SimplePaint code? */
     1385        //            if(!profilerOmitDraw)
    13851386                        visitVirtual((Way)osm);
    1386                     profilerN++;
    1387                 }
    1388 
    1389             if(profiler)
    1390             {
    1391                 System.out.format("Virtual  : %5dms, calls=%7d\n", (java.lang.System.currentTimeMillis()-profilerLast), profilerN);
    1392                 profilerLast = java.lang.System.currentTimeMillis();
    1393             }
     1387        //            profilerN++;
     1388                }
     1389
     1390        //    if(profiler)
     1391        //    {
     1392        //        System.out.format("Virtual  : %5dms, calls=%7d\n", (java.lang.System.currentTimeMillis()-profilerLast), profilerN);
     1393        //        profilerLast = java.lang.System.currentTimeMillis();
     1394        //    }
    13941395
    13951396            displaySegments(null);
    13961397        }
    13971398
    1398         if(profiler)
    1399         {
    1400             System.out.format("Segments :          calls=%7d, visible=%d\n", profilerSegments, profilerVisibleSegments);
    1401             System.out.format("All      : %5dms\n", (profilerLast-profilerStart));
    1402         }
     1399        //if(profiler)
     1400        //{
     1401        //    System.out.format("Segments :          calls=%7d, visible=%d\n", profilerSegments, profilerVisibleSegments);
     1402        //    System.out.format("All      : %5dms\n", (profilerLast-profilerStart));
     1403        //}
    14031404    }
    14041405
  • trunk/src/org/openstreetmap/josm/data/osm/visitor/SimplePaintVisitor.java

    r1409 r1415  
    1 // License: GPL. Copyright 2007 by Immanuel Scholz and others
     1/* License: GPL. Copyright 2007 by Immanuel Scholz and others */
    22package org.openstreetmap.josm.data.osm.visitor;
     3
     4/* To enable debugging or profiling remove the double / signs */
    35
    46import static org.openstreetmap.josm.tools.I18n.marktr;
     
    127129
    128130    public void visitAll(DataSet data, Boolean virtual) {
    129         boolean profiler = Main.pref.getBoolean("simplepaint.profiler",false);
    130         long profilerStart = java.lang.System.currentTimeMillis();
    131         long profilerLast = profilerStart;
    132         int profilerN = 0;
    133         if(profiler)
    134             System.out.println("Simplepaint Profiler");
     131        //boolean profiler = Main.pref.getBoolean("simplepaint.profiler",false);
     132        //long profilerStart = java.lang.System.currentTimeMillis();
     133        //long profilerLast = profilerStart;
     134        //int profilerN = 0;
     135        //if(profiler)
     136        //    System.out.println("Simplepaint Profiler");
    135137
    136138        getSettings(virtual);
    137139
    138         if(profiler)
    139         {
    140             System.out.format("Prepare  : %4dms\n", (java.lang.System.currentTimeMillis()-profilerLast));
    141             profilerLast = java.lang.System.currentTimeMillis();
    142         }
    143 
    144         // draw tagged ways first, then untagged ways. takes
    145         // time to iterate through list twice, OTOH does not
    146         // require changing the colour while painting...
    147         profilerN = 0;
     140        //if(profiler)
     141        //{
     142        //    System.out.format("Prepare  : %4dms\n", (java.lang.System.currentTimeMillis()-profilerLast));
     143        //    profilerLast = java.lang.System.currentTimeMillis();
     144        //}
     145
     146        /* draw tagged ways first, then untagged ways. takes
     147          time to iterate through list twice, OTOH does not
     148           require changing the colour while painting... */
     149        //profilerN = 0;
    148150        for (final OsmPrimitive osm : data.relations)
    149151            if (!osm.deleted && !osm.selected)
    150152            {
    151153                osm.visit(this);
    152                 profilerN++;
    153             }
    154 
    155         if(profiler)
    156         {
    157             System.out.format("Relations: %4dms, n=%5d\n", (java.lang.System.currentTimeMillis()-profilerLast), profilerN);
    158             profilerLast = java.lang.System.currentTimeMillis();
    159         }
    160 
    161         profilerN = 0;
     154        //        profilerN++;
     155            }
     156
     157        //if(profiler)
     158        //{
     159        //    System.out.format("Relations: %4dms, n=%5d\n", (java.lang.System.currentTimeMillis()-profilerLast), profilerN);
     160        //    profilerLast = java.lang.System.currentTimeMillis();
     161        //}
     162
     163        //profilerN = 0;
    162164        for (final OsmPrimitive osm : data.ways)
    163165            if (!osm.deleted && !osm.selected && osm.tagged)
    164166            {
    165167                osm.visit(this);
    166                 profilerN++;
     168        //        profilerN++;
    167169            }
    168170        displaySegments();
     
    172174            {
    173175                osm.visit(this);
    174                 profilerN++;
     176        //        profilerN++;
    175177            }
    176178        displaySegments();
    177179
    178         if(profiler)
    179         {
    180             System.out.format("Ways     : %4dms, n=%5d\n",
    181                 (java.lang.System.currentTimeMillis()-profilerLast), profilerN);
    182             profilerLast = java.lang.System.currentTimeMillis();
    183         }
    184 
    185         profilerN = 0;
     180        //if(profiler)
     181        //{
     182        //    System.out.format("Ways     : %4dms, n=%5d\n",
     183        //        (java.lang.System.currentTimeMillis()-profilerLast), profilerN);
     184        //    profilerLast = java.lang.System.currentTimeMillis();
     185        //}
     186
     187        //profilerN = 0;
    186188        for (final OsmPrimitive osm : data.getSelected())
    187189            if (!osm.deleted)
    188190            {
    189191                osm.visit(this);
    190                 profilerN++;
     192        //        profilerN++;
    191193            }
    192194        displaySegments();
    193195
    194         if(profiler)
    195         {
    196             System.out.format("Selected : %4dms, n=%5d\n", (java.lang.System.currentTimeMillis()-profilerLast), profilerN);
    197             profilerLast = java.lang.System.currentTimeMillis();
    198         }
    199 
    200         profilerN = 0;
     196        //if(profiler)
     197        //{
     198        //    System.out.format("Selected : %4dms, n=%5d\n", (java.lang.System.currentTimeMillis()-profilerLast), profilerN);
     199        //    profilerLast = java.lang.System.currentTimeMillis();
     200        //}
     201
     202        //profilerN = 0;
    201203        for (final OsmPrimitive osm : data.nodes)
    202204            if (!osm.deleted && !osm.selected)
    203205            {
    204206                osm.visit(this);
    205                 profilerN++;
    206             }
    207         if(profiler)
    208         {
    209             System.out.format("Nodes    : %4dms, n=%5d\n",
    210                 (java.lang.System.currentTimeMillis()-profilerLast), profilerN);
    211             profilerLast = java.lang.System.currentTimeMillis();
    212         }
     207        //        profilerN++;
     208            }
     209
     210        //if(profiler)
     211        //{
     212        //    System.out.format("Nodes    : %4dms, n=%5d\n",
     213        //        (java.lang.System.currentTimeMillis()-profilerLast), profilerN);
     214        //    profilerLast = java.lang.System.currentTimeMillis();
     215        //}
    213216
    214217        if(virtualNodeSize != 0)
    215218        {
    216             profilerN = 0;
     219        //    profilerN = 0;
    217220            currentColor = nodeColor;
    218221            for (final OsmPrimitive osm : data.ways)
     
    220223                    {
    221224                        visitVirtual((Way)osm);
    222                         profilerN++;
     225        //                profilerN++;
    223226                    }
    224227            displaySegments();
    225228
    226             if(profiler)
    227             {
    228                 System.out.format("Virtual  : %4dms, n=%5d\n", (java.lang.System.currentTimeMillis()-profilerLast), profilerN);
    229                 profilerLast = java.lang.System.currentTimeMillis();
    230             }
    231         }
    232 
    233         if(profiler)
    234         {
    235             System.out.format("All      : %4dms\n", (profilerLast-profilerStart));
    236         }
     229        //    if(profiler)
     230        //    {
     231        //        System.out.format("Virtual  : %4dms, n=%5d\n", (java.lang.System.currentTimeMillis()-profilerLast), profilerN);
     232        //        profilerLast = java.lang.System.currentTimeMillis();
     233        //    }
     234        }
     235
     236        //if(profiler)
     237        //{
     238        //    System.out.format("All      : %4dms\n", (profilerLast-profilerStart));
     239        //}
    237240    }
    238241
     
    294297            return;
    295298
    296         // show direction arrows, if draw.segment.relevant_directions_only is not set, the way is tagged with a direction key
    297         // (even if the tag is negated as in oneway=false) or the way is selected
     299        /* show direction arrows, if draw.segment.relevant_directions_only is not set, the way is tagged with a direction key
     300           (even if the tag is negated as in oneway=false) or the way is selected */
    298301
    299302        boolean showThisDirectionArrow = w.selected
    300303        || (showDirectionArrow && (!showRelevantDirectionsOnly || w.hasDirectionKeys));
    301         // head only takes over control if the option is true,
    302         // the direction should be shown at all and not only because it's selected
     304        /* head only takes over control if the option is true,
     305           the direction should be shown at all and not only because it's selected */
    303306        boolean showOnlyHeadArrowOnly = showThisDirectionArrow && !w.selected && showHeadArrowOnly;
    304307        Color wayColor;
     
    390393            }
    391394
    392             displaySegments(); // draw nodes on top!
     395            displaySegments(); /* draw nodes on top! */
    393396            Color c = g.getColor();
    394397            g.setColor(backgroundColor);
  • trunk/src/org/openstreetmap/josm/data/projection/Lambert.java

    r1309 r1415  
    206206     * reference ellipsoid used by Lambert is Clark
    207207     *
    208      * @param coord projected coordinates pair in meters
    209      * @param Xs    false east (coordinate system origin) in meters
    210      * @param Ys    false north (coordinate system origin) in meters
    211      * @param c     projection constant
    212      * @param n     projection exponent
     208     * @param eastNorth projected coordinates pair in meters
     209     * @param Xs        false east (coordinate system origin) in meters
     210     * @param Ys        false north (coordinate system origin) in meters
     211     * @param c         projection constant
     212     * @param n         projection exponent
    213213     * @return LatLon in radian
    214214     */
     
    236236     * Translate latitude/longitude in WGS84, (ellipsoid GRS80) to Lambert
    237237     * geographic, (ellipsoid Clark)
    238      *
    239      * @param wgs
    240      * @return
    241238     */
    242239    private LatLon GRS802Clark(LatLon wgs) {
     
    256253    }
    257254
    258     /**
    259      * @param lambert
    260      * @return
    261      */
    262255    private LatLon Clark2GRS80(LatLon lambert) {
    263256        double lat = lambert.lat(); // in radian
  • trunk/src/org/openstreetmap/josm/gui/ExtendedDialog.java

    r1397 r1415  
    44import java.awt.Dimension;
    55import java.awt.event.ActionEvent;
    6 import java.awt.event.ComponentEvent;
    7 import java.awt.event.ComponentListener;
    86import java.awt.GridBagLayout;
    97import java.awt.Toolkit;
     
    119import javax.swing.AbstractAction;
    1210import javax.swing.Action;
    13 import javax.swing.BorderFactory;
    14 import javax.swing.BoundedRangeModel;
    15 import javax.swing.InputMap;
    1611import javax.swing.JButton;
    1712import javax.swing.JComponent;
     
    1914import javax.swing.JOptionPane;
    2015import javax.swing.JPanel;
    21 import javax.swing.JRootPane;
    2216import javax.swing.JScrollBar;
    2317import javax.swing.JScrollPane;
    2418import javax.swing.KeyStroke;
    2519
    26 import org.openstreetmap.josm.Main;
    2720import org.openstreetmap.josm.gui.JMultilineLabel;
    2821import org.openstreetmap.josm.tools.GBC;
    29 import org.openstreetmap.josm.tools.I18n;
    3022import org.openstreetmap.josm.tools.ImageProvider;
    3123
     
    3729    /**
    3830     * Sets up the dialog. The first button is always the default.
    39      * @param Component The parent element that will be used for position and maximum size
    40      * @param String The text that will be shown in the window titlebar
    41      * @param Component Any component that should be show above the buttons (e.g. JLabel)
    42      * @param String[] The labels that will be displayed on the buttons
    43      * @param String[] The path to the icons that will be displayed on the buttons. Path is relative to JOSM's image directory. File extensions need to be included. If a button should not have an icon pass null.
     31     * @param parent The parent element that will be used for position and maximum size
     32     * @param title The text that will be shown in the window titlebar
     33     * @param content Any component that should be show above the buttons (e.g. JLabel)
     34     * @param buttonTexts The labels that will be displayed on the buttons
     35     * @param buttonIcons The path to the icons that will be displayed on the buttons. Path is relative to JOSM's image directory. File extensions need to be included. If a button should not have an icon pass null.
    4436     */
    4537    public ExtendedDialog(Component parent, String title, Component content, String[] buttonTexts, String[] buttonIcons) {
  • trunk/src/org/openstreetmap/josm/gui/GettingStarted.java

    r1370 r1415  
    1515
    1616import java.awt.BorderLayout;
    17 import java.awt.Component;
    1817import java.awt.EventQueue;
    1918
     
    142141        ArrayList<Future<String>> linkContent = new ArrayList<Future<String>>();
    143142        for(int i=0; i < links.size(); i++) {
    144             String[] obj = (String[])links.get(i);
     143            String[] obj = links.get(i);
    145144            int targetVersion = Integer.parseInt(obj[1]);
    146145            String condition = obj[0];
  • trunk/src/org/openstreetmap/josm/gui/MainApplication.java

    r1356 r1415  
    1111import java.awt.event.WindowAdapter;
    1212import java.awt.event.WindowEvent;
    13 import java.io.File;
    14 import java.io.IOException;
    1513import java.util.Arrays;
    1614import java.util.Collection;
  • trunk/src/org/openstreetmap/josm/gui/MainMenu.java

    r1380 r1415  
    6363import org.openstreetmap.josm.actions.search.SearchAction;
    6464import org.openstreetmap.josm.actions.ToggleGPXLinesAction;
    65 import org.openstreetmap.josm.data.DataSetChecker;
    6665import org.openstreetmap.josm.tools.Shortcut;
    6766
  • trunk/src/org/openstreetmap/josm/gui/MapFrame.java

    r1405 r1415  
    179179    public void addMapMode(IconToggleButton b) {
    180180        toolBarActions.add(b);
    181         toolGroup.add((AbstractButton)b);
     181        toolGroup.add(b);
    182182    }
    183183
  • trunk/src/org/openstreetmap/josm/gui/MapSlider.java

    r1337 r1415  
    3131        double sizey = this.mv.scale * this.mv.getHeight();
    3232        for (int zoom = 0; zoom <= 150; zoom++, sizex *= 1.1, sizey *= 1.1) {
    33             if (sizex > this.mv.world.east() || sizey > this.mv.world.north()) {
     33            if (sizex > MapView.world.east() || sizey > MapView.world.north()) {
    3434                preventChange=true;
    3535                setValue(zoom);
  • trunk/src/org/openstreetmap/josm/gui/MapStatus.java

    r1350 r1415  
    2424import java.awt.event.MouseListener;
    2525import java.lang.reflect.InvocationTargetException;
    26 import java.text.DecimalFormat;
    2726import java.util.Collection;
    2827import java.util.ConcurrentModificationException;
  • trunk/src/org/openstreetmap/josm/gui/MapView.java

    r1379 r1415  
    365365         * that I switch layers and actions at the same time and it was annoying to mind the
    366366         * order. This way it works as visual clue for new users */
    367         for (Enumeration e = Main.map.toolGroup.getElements() ; e.hasMoreElements() ;) {
    368             AbstractButton x=(AbstractButton)e.nextElement();
     367        for (Enumeration<AbstractButton> e = Main.map.toolGroup.getElements() ; e.hasMoreElements() ;) {
     368            AbstractButton x=e.nextElement();
    369369            x.setEnabled(((MapMode)x.getAction()).layerIsSupported(layer));
    370370        }
     
    400400     *
    401401     * @return <code>true</code> if a zoom operation has been performed
    402      * @author Jan Peter Stotz
    403402     */
    404403    public boolean zoomToEditLayerBoundingBox() {
  • trunk/src/org/openstreetmap/josm/gui/PleaseWaitDialog.java

    r1372 r1415  
    33
    44import java.awt.Component;
    5 import java.awt.Dimension;
    65import java.awt.GridBagLayout;
    76import java.awt.event.ComponentEvent;
  • trunk/src/org/openstreetmap/josm/gui/dialogs/PropertiesDialog.java

    r1414 r1415  
    3232
    3333import javax.swing.Box;
    34 import javax.swing.DefaultComboBoxModel;
    3534import javax.swing.DefaultListCellRenderer;
    3635import javax.swing.JComboBox;
     
    259258        }
    260259
    261         Main.ds.fireSelectionChanged(sel);
     260        DataSet.fireSelectionChanged(sel);
    262261        selectionChanged(sel); // update whole table
    263262        Main.parent.repaint(); // repaint all - drawing could have been changed
     
    342341            return;
    343342        Main.main.undoRedo.add(new ChangePropertyCommand(sel, key, value));
    344         Main.ds.fireSelectionChanged(sel);
     343        DataSet.fireSelectionChanged(sel);
    345344        selectionChanged(sel); // update table
    346345        Main.parent.repaint(); // repaint all - drawing could have been changed
     
    366365    }
    367366    private String objKey;
    368     /**
    369      * @return
    370      */
     367
    371368    private TreeMap<String, TreeSet<String>> createAutoCompletionInfo(
    372369            boolean edit) {
     
    399396        Collection<OsmPrimitive> sel = Main.ds.getSelected();
    400397        Main.main.undoRedo.add(new ChangePropertyCommand(sel, key, null));
    401         Main.ds.fireSelectionChanged(sel);
     398        DataSet.fireSelectionChanged(sel);
    402399        selectionChanged(sel); // update table
    403400
     
    582579                            }
    583580                            Main.main.undoRedo.add(new ChangeCommand(cur, rel));
    584                             Main.ds.fireSelectionChanged(sel);
     581                            DataSet.fireSelectionChanged(sel);
    585582                            selectionChanged(sel); // update whole table
    586583                        }
  • trunk/src/org/openstreetmap/josm/gui/dialogs/RelationEditor.java

    r1378 r1415  
    66import java.awt.BorderLayout;
    77import java.awt.Dimension;
    8 import java.awt.FlowLayout;
    98import java.awt.GridBagLayout;
    109import java.awt.GridLayout;
     
    110109    private final JTable memberTable = new JTable(memberData);
    111110
    112     // =================== FIXME FIXME FIXME =====================
     111    // =================== FIXME =====================
    113112    // As soon as API 0.5 is dead, drop all the collation stuff from here ...
    114113
     
    208207        this.relation = relation;
    209208
    210         ordered = Main.pref.get("osm-server.version", "0.5").equals("0.6");
     209        ordered = !Main.pref.get("osm-server.version", "0.5").equals("0.5");
    211210
    212211        if (relation == null) {
     
    248247        });
    249248
    250         /* I don't like this text any more. Let's just get on with doing the specialist
    251          * editors instead of talking about it.
    252         JLabel help = new JLabel("<html><em>"+
    253             tr("This is the basic relation editor which allows you to change the relation's tags " +
    254             "as well as the members. In addition to this we should have a smart editor that " +
    255             "detects the type of relationship and limits your choices in a sensible way.")+"</em></html>");
    256         getContentPane().add(help, BorderLayout.NORTH);
    257          */
    258249        try { setAlwaysOnTop(true); } catch (SecurityException sx) {}
    259250
     
    326317        bothTables.add(new JScrollPane(propertyTable), GBC.eop().fill(GBC.BOTH));
    327318        bothTables.add(status = new JLabel(tr("Members")), GBC.eol().fill(GBC.HORIZONTAL));
     319        // this is not exactly pretty but the four buttons simply don't fit in one line.
     320        // we should have smaller buttons for situations like this.
     321        JPanel buttonPanel = new JPanel(new GridLayout(2,ordered ? 3 : 2));
     322
    328323        if (ordered) {
    329             JPanel upDownPanel = new JPanel();
    330             upDownPanel.setLayout(new BoxLayout(upDownPanel, BoxLayout.Y_AXIS));
    331 
    332             upDownPanel.add(createButton(null, "moveup", tr("Move the currently selected members up"),
    333                     KeyEvent.VK_U, new ActionListener() {
     324            buttonPanel.add(createButton(null, "moveup", tr("Move the currently selected members up"), KeyEvent.VK_U, new ActionListener() {
    334325                public void actionPerformed(ActionEvent e) {
    335326                    moveMembers(-1);
    336327                }
    337328            }));
    338             upDownPanel.add(createButton(null, "movedown", tr("Move the currently selected members down"),
    339                     KeyEvent.VK_N, new ActionListener() {
    340                 public void actionPerformed(ActionEvent e) {
    341                     moveMembers(1);
    342                 }
    343             }));
    344 
    345 
    346             bothTables.add(new JScrollPane(memberTable), GBC.std().fill(GBC.BOTH));
    347             bothTables.add(upDownPanel, GBC.eol().fill(GBC.VERTICAL));
    348         } else {
    349             bothTables.add(new JScrollPane(memberTable), GBC.eol().fill(GBC.BOTH));
    350         }
    351 
    352         // this is not exactly pretty but the four buttons simply don't fit in one line.
    353         // we should have smaller buttons for situations like this.
    354         JPanel buttonPanel = new JPanel(new GridLayout(2,2));
     329        }
     330        bothTables.add(new JScrollPane(memberTable), GBC.eol().fill(GBC.BOTH));
    355331
    356332        buttonPanel.add(createButton(marktr("Add Selected"),"addselected",
     
    367343            }
    368344        }));
     345
     346        if(ordered) {
     347            buttonPanel.add(createButton(null, "movedown", tr("Move the currently selected members down"), KeyEvent.VK_N, new ActionListener() {
     348                public void actionPerformed(ActionEvent e) {
     349                    moveMembers(1);
     350                }
     351            }));
     352        }
    369353
    370354        buttonPanel.add(createButton(marktr("Remove"),"remove",
     
    382366        }));
    383367
    384         /*buttonPanel.add(createButton(marktr("Select"),"select",
    385         tr("Highlight the member from the current table row as JOSM's selection"), KeyEvent.VK_S, new ActionListener() {
    386             public void actionPerformed(ActionEvent e) {
    387                 ArrayList<OsmPrimitive> sel;
    388                 int cnt = memberTable.getSelectedRowCount();
    389                 if(cnt > 0)
    390                 {
    391                     sel = new ArrayList<OsmPrimitive>(cnt);
    392                     for (int i : memberTable.getSelectedRows())
    393                         sel.add((OsmPrimitive)memberTable.getValueAt(i, 1));
    394                 }
    395                 else
    396                 {
    397                     cnt = memberTable.getRowCount();
    398                     sel = new ArrayList<OsmPrimitive>(cnt);
    399                     for (int i = 0; i < cnt; ++i)
    400                         sel.add((OsmPrimitive)memberTable.getValueAt(i, 1));
    401                 }
    402                 Main.ds.setSelected(sel);
    403             }
    404         }));*/
    405368        buttonPanel.add(createButton(marktr("Download Members"),"downloadincomplete",
    406369        tr("Download all incomplete ways and nodes in relation"), KeyEvent.VK_L, new ActionListener() {
  • trunk/src/org/openstreetmap/josm/gui/dialogs/RelationListDialog.java

    r1331 r1415  
    1919import javax.swing.ListSelectionModel;
    2020import javax.swing.event.ListSelectionListener;
    21 import javax.swing.event.ListSelectionEvent;
    22 
    2321import org.openstreetmap.josm.Main;
    24 import org.openstreetmap.josm.actions.AutoScaleAction;
    2522import org.openstreetmap.josm.command.DeleteCommand;
    2623import org.openstreetmap.josm.data.osm.DataSet;
  • trunk/src/org/openstreetmap/josm/gui/download/BoundingBoxSelection.java

    r1345 r1415  
    44import static org.openstreetmap.josm.tools.I18n.tr;
    55
    6 import java.awt.Color;
    76import java.awt.Dimension;
    87import java.awt.GridBagLayout;
     
    1211import java.awt.event.KeyEvent;
    1312import java.awt.event.KeyListener;
    14 import java.awt.event.MouseAdapter;
    15 import java.util.HashMap;
    1613
    1714import javax.swing.JLabel;
     
    2421
    2522import org.openstreetmap.josm.data.Bounds;
    26 import org.openstreetmap.josm.data.coor.LatLon;
    2723import org.openstreetmap.josm.tools.GBC;
    2824import org.openstreetmap.josm.tools.OsmUrlToBounds;
     
    8783            public void keyPressed(KeyEvent keyEvent) {}
    8884            public void keyReleased(KeyEvent keyEvent) {
    89                 if (keyEvent.getKeyCode() == keyEvent.VK_ENTER && parseURL(gui))
     85                if (keyEvent.getKeyCode() == KeyEvent.VK_ENTER && parseURL(gui))
    9086                    gui.closeDownloadDialog(true);
    9187            }
  • trunk/src/org/openstreetmap/josm/gui/layer/OsmDataLayer.java

    r1353 r1415  
    4141import org.openstreetmap.josm.actions.SaveAction;
    4242import org.openstreetmap.josm.actions.SaveAsAction;
    43 import org.openstreetmap.josm.command.Command;
    4443import org.openstreetmap.josm.data.coor.EastNorth;
    4544import org.openstreetmap.josm.data.coor.LatLon;
     
    222221    @Override public void mergeFrom(final Layer from) {
    223222        final MergeVisitor visitor = new MergeVisitor(data,((OsmDataLayer)from).data);
    224 //        int i=0;
    225         int max = ((OsmDataLayer)from).data.allPrimitives().size();
    226 
    227 //        System.out.format("Add/Merge data:");
    228 
    229223        for (final OsmPrimitive osm : ((OsmDataLayer)from).data.allPrimitives()) {
    230224//            i++;
  • trunk/src/org/openstreetmap/josm/gui/layer/markerlayer/PlayHeadMarker.java

    r1245 r1415  
    129129
    130130    /**
    131      * Find the closest track point within the pixelTolerance of the screen point pNear
    132      * @param pNear : the point in screen coordinates near which to find a track point
    133      * @param pixelTolerance : only accept the point if within this number of pixels of en
    134      * @return the nearest trackpoint or null if nothing nearby
    135      *
    136      * XXX seems unused, F.R. 2008-03-15
    137     private WayPoint getClosestTrackPoint(Point pNear, double pixelTolerance) {
    138         WayPoint cw = null;
    139         AudioMarker recentlyPlayedMarker = AudioMarker.recentlyPlayedMarker();
    140         if (recentlyPlayedMarker != null) {
    141             // Find the track point closest to letting go of the play head
    142             double minDistance = pixelTolerance;
    143             GpxLayer trackLayer = recentlyPlayedMarker.parentLayer.fromLayer;
    144             if (trackLayer.data.tracks == null)
    145                 return null;
    146 
    147             for (GpxTrack track : trackLayer.data.tracks) {
    148                 if (track.trackSegs == null)
    149                     continue;
    150 
    151                 for (Collection<WayPoint> trackseg : track.trackSegs) {
    152                     for (WayPoint w : trackseg) {
    153                         Point p = Main.map.mapView.getPoint(w.eastNorth);
    154                         double distance = p.distance(pNear);
    155                         if (distance <= minDistance) {
    156                             cw = w;
    157                             minDistance = distance;
    158                         }
    159                     }
    160                 }
    161             }
    162         }
    163         return cw;
    164     }
    165     */
    166 
    167     /**
    168131     * reposition the play head at the point on the track nearest position given,
    169132     * providing we are within reasonable distance from the track; otherwise reset to the
  • trunk/src/org/openstreetmap/josm/gui/mappaint/ElemStyles.java

    r1313 r1415  
    1111import org.openstreetmap.josm.data.osm.OsmPrimitive;
    1212import org.openstreetmap.josm.data.osm.OsmUtils;
    13 import org.openstreetmap.josm.data.osm.Relation;
    14 import org.openstreetmap.josm.data.osm.Way;
    1513import org.openstreetmap.josm.Main;
    1614
  • trunk/src/org/openstreetmap/josm/gui/preferences/ColorPreference.java

    r1243 r1415  
    22package org.openstreetmap.josm.gui.preferences;
    33
    4 import static org.openstreetmap.josm.tools.I18n.marktr;
    54import static org.openstreetmap.josm.tools.I18n.tr;
    65
     
    1312import java.util.regex.Matcher;
    1413import java.util.regex.Pattern;
    15 import java.util.ArrayList;
    16 import java.util.Collections;
    1714import java.util.HashMap;
    18 import java.util.List;
    1915import java.util.Map;
    2016import java.util.Map.Entry;
     
    3329import javax.swing.table.TableCellRenderer;
    3430import javax.swing.BorderFactory;
    35 import javax.swing.Box;
    3631
    3732import org.openstreetmap.josm.Main;
    3833import org.openstreetmap.josm.data.osm.visitor.MapPaintVisitor;
    3934import org.openstreetmap.josm.gui.layer.markerlayer.MarkerLayer;
    40 import org.openstreetmap.josm.gui.layer.GpxLayer;
    41 import org.openstreetmap.josm.gui.layer.OsmDataLayer;
    4235import org.openstreetmap.josm.gui.MapScaler;
    4336import org.openstreetmap.josm.gui.dialogs.ConflictDialog;
     
    7770                colorKeyList.put(getName(key), key);
    7871        }
    79         for (Entry k : colorKeyList.entrySet()) {
     72        for (Entry<String, String> k : colorKeyList.entrySet()) {
    8073            Vector<Object> row = new Vector<Object>(2);
    8174            row.add(k.getValue());
     
    8376            tableModel.addRow(row);
    8477        }
    85         for (Entry k : colorKeyList_mappaint.entrySet()) {
     78        for (Entry<String, String> k : colorKeyList_mappaint.entrySet()) {
    8679            Vector<Object> row = new Vector<Object>(2);
    8780            row.add(k.getValue());
  • trunk/src/org/openstreetmap/josm/gui/preferences/LanguagePreference.java

    r1180 r1415  
    5555
    5656        JPanel panel = null;
    57         for(PreferenceSetting s : gui.settings)
     57        for(PreferenceSetting s : PreferenceDialog.settings)
    5858        {
    5959            if(s instanceof LafPreference)
  • trunk/src/org/openstreetmap/josm/gui/preferences/PluginPreference.java

    r1326 r1415  
    2222import javax.swing.Scrollable;
    2323
    24 import org.openstreetmap.josm.Main;
    2524import org.openstreetmap.josm.plugins.PluginDownloader;
    2625import org.openstreetmap.josm.plugins.PluginSelection;
  • trunk/src/org/openstreetmap/josm/gui/preferences/PreferenceDialog.java

    r1326 r1415  
    77import java.awt.GridBagLayout;
    88import java.awt.ScrollPane;
    9 import java.awt.event.ActionEvent;
    10 import java.awt.event.ActionListener;
    119import java.util.Collection;
    1210import java.util.Iterator;
     
    5654     */
    5755    public JPanel createPreferenceTab(String icon, String title, String desc) {
    58         return createPreferenceTab(icon, title, desc, true);
     56        return createPreferenceTab(icon, title, desc, false);
    5957    }
    6058
  • trunk/src/org/openstreetmap/josm/gui/preferences/TaggingPresetPreference.java

    r1399 r1415  
    1111import java.util.Collection;
    1212import java.util.HashMap;
    13 import java.util.StringTokenizer;
    1413
    1514import javax.swing.BorderFactory;
  • trunk/src/org/openstreetmap/josm/gui/tagging/TaggingPreset.java

    r1360 r1415  
    99import java.awt.Image;
    1010import java.awt.event.ActionEvent;
    11 import java.awt.event.ActionListener;
    1211import java.io.BufferedReader;
    1312import java.io.InputStreamReader;
     
    2726import javax.swing.Action;
    2827import javax.swing.ImageIcon;
    29 import javax.swing.JButton;
    3028import javax.swing.JComboBox;
    3129import javax.swing.JComponent;
     
    5048import org.openstreetmap.josm.tools.GBC;
    5149import org.openstreetmap.josm.tools.ImageProvider;
    52 import org.openstreetmap.josm.tools.OpenBrowser;
    5350import org.openstreetmap.josm.tools.UrlLabel;
    5451import org.openstreetmap.josm.tools.XmlObjectParser;
  • trunk/src/org/openstreetmap/josm/io/DiffResultReader.java

    r1195 r1415  
    77import java.io.InputStream;
    88import java.io.InputStreamReader;
    9 import java.util.ArrayList;
    10 import java.util.Arrays;
    119import java.util.Collection;
    1210import java.util.HashMap;
    13 import java.util.HashSet;
    14 import java.util.LinkedList;
    1511import java.util.Map;
    16 import java.util.Map.Entry;
    1712
    1813import javax.xml.parsers.ParserConfigurationException;
    1914import javax.xml.parsers.SAXParserFactory;
    2015
    21 import org.openstreetmap.josm.Main;
    22 import org.openstreetmap.josm.data.Bounds;
    23 import org.openstreetmap.josm.data.coor.LatLon;
    24 import org.openstreetmap.josm.data.osm.DataSet;
    25 import org.openstreetmap.josm.data.osm.DataSource;
    2616import org.openstreetmap.josm.data.osm.Node;
    2717import org.openstreetmap.josm.data.osm.OsmPrimitive;
    2818import org.openstreetmap.josm.data.osm.Relation;
    29 import org.openstreetmap.josm.data.osm.RelationMember;
    30 import org.openstreetmap.josm.data.osm.User;
    3119import org.openstreetmap.josm.data.osm.Way;
    32 import org.openstreetmap.josm.data.osm.visitor.AddVisitor;
    3320import org.openstreetmap.josm.data.osm.visitor.Visitor;
    3421import org.openstreetmap.josm.gui.PleaseWaitDialog;
     
    7764    /**
    7865     * Parse the given input source and return the dataset.
    79      * @param ref The dataset that is search in for references first. If
    80      *      the Reference is not found here, Main.ds is searched and a copy of the
    81      *  elemet found there is returned.
    8266     */
    8367    public static void parseDiffResult(InputStream source, Collection<OsmPrimitive> osm, Collection<OsmPrimitive> processed, Map<OsmPrimitive,Long> newIdMap, PleaseWaitDialog pleaseWaitDlg)
  • trunk/src/org/openstreetmap/josm/io/NmeaReader.java

    r1388 r1415  
    1111import java.text.SimpleDateFormat;
    1212import java.util.ArrayList;
    13 import java.util.Arrays;
    1413import java.util.Collection;
    1514import java.util.Date;
     
    202201            }
    203202            rd.close();
    204             Object[] wparr = ps.waypoints.toArray();
    205203            currentTrack.trackSegs.add(ps.waypoints);
    206204            data.recalculateBounds();
  • trunk/src/org/openstreetmap/josm/io/OsmReader.java

    r1353 r1415  
    77import java.io.InputStream;
    88import java.io.InputStreamReader;
    9 import java.io.FileInputStream;
    10 import java.nio.channels.FileChannel;
    119import java.util.ArrayList;
    1210import java.util.Arrays;
     
    436434
    437435          // Cache the ways here for much better search performance
    438           HashMap hm = new HashMap(10000);
     436          HashMap<Long, Way> hm = new HashMap<Long, Way>(10000);
    439437          for (Way wy : ds.ways)
    440438            hm.put(wy.id, wy);
     
    454452                         }
    455453                    } else if (emd.type.equals("way")) {
    456                          em.member = (OsmPrimitive)hm.get(emd.id);
     454                         em.member = hm.get(emd.id);
    457455                         if (em.member == null)
    458456                            em.member = findWay(emd.id);
  • trunk/src/org/openstreetmap/josm/io/OsmServerObjectReader.java

    r1169 r1415  
    2828    /**
    2929     * Method to download single objects from OSM server. ways, relations, nodes
    30      * @param id Object ID
    31      * @param type way node relation
    32      * @param full download with or without child objects
    3330     * @return the data requested
    3431     * @throws SAXException
  • trunk/src/org/openstreetmap/josm/io/OsmServerWriter.java

    r1395 r1415  
    44import static org.openstreetmap.josm.tools.I18n.tr;
    55
    6 import java.io.BufferedOutputStream;
    76import java.io.BufferedReader;
    87import java.io.ByteArrayOutputStream;
     
    1312import java.io.OutputStreamWriter;
    1413import java.io.PrintWriter;
    15 import java.io.StringWriter;
    1614import java.io.UnsupportedEncodingException;
    1715import java.lang.Math;
  • trunk/src/org/openstreetmap/josm/plugins/PluginHandler.java

    r1397 r1415  
    44import static org.openstreetmap.josm.tools.I18n.tr;
    55
    6 import java.awt.Dimension;
    76import java.awt.Font;
    87import java.awt.GridBagLayout;
  • trunk/src/org/openstreetmap/josm/plugins/PluginSelection.java

    r1397 r1415  
    66
    77import java.awt.GridBagConstraints;
    8 import java.awt.GridBagLayout;
    98import java.awt.Insets;
    109import java.awt.event.ActionEvent;
     
    2726import java.util.Map.Entry;
    2827
    29 import javax.swing.AbstractAction;
    3028import javax.swing.BorderFactory;
    3129import javax.swing.JCheckBox;
  • trunk/src/org/openstreetmap/josm/tools/BugReportExceptionHandler.java

    r1326 r1415  
    1010import java.awt.datatransfer.StringSelection;
    1111import java.awt.datatransfer.Transferable;
    12 import java.io.BufferedReader;
    13 import java.io.File;
    14 import java.io.InputStreamReader;
    1512import java.io.PrintWriter;
    1613import java.io.StringWriter;
    17 import java.net.URL;
    18 import java.text.DateFormat;
    19 import java.text.SimpleDateFormat;
    20 import java.util.Arrays;
    21 import java.util.Date;
    22 import java.util.LinkedList;
    2314
    2415import javax.swing.JLabel;
  • trunk/src/org/openstreetmap/josm/tools/PlatformHookOsx.java

    r1195 r1415  
    4545        //System.out.println("Going to handle method "+method+" (short: "+method.getName()+") with event "+args[0]);
    4646        if (method.getName().equals("handleQuit")) {
    47             handled = !Main.main.breakBecauseUnsavedChanges();
     47            handled = !Main.breakBecauseUnsavedChanges();
    4848        } else if (method.getName().equals("handleAbout")) {
    4949            Main.main.menu.about.actionPerformed(null);
  • trunk/src/org/openstreetmap/josm/tools/PlatformHookWindows.java

    r1169 r1415  
    22package org.openstreetmap.josm.tools;
    33
    4 import static org.openstreetmap.josm.tools.I18n.tr;
    54import org.openstreetmap.josm.tools.Shortcut;
    65import org.openstreetmap.josm.tools.PlatformHookUnixoid;
  • trunk/src/org/openstreetmap/josm/tools/PresetTextComparator.java

    r1402 r1415  
    55import javax.swing.JMenuItem;
    66
    7 public class PresetTextComparator implements Comparator {
     7public class PresetTextComparator implements Comparator<JMenuItem> {
    88        //TODO add error checking and stuff
    9         public int compare(Object arg0, Object arg1) {
    10                 return ((JMenuItem)arg0).getText().compareTo(((JMenuItem)arg1).getText());
     9        public int compare(JMenuItem arg0, JMenuItem arg1) {
     10                return arg0.getText().compareTo(arg1.getText());
    1111        }
    1212
  • trunk/src/org/openstreetmap/josm/tools/Shortcut.java

    r1182 r1415  
    260260    public static final int GROUPS_ALT2 = GROUP__MAX * 2;
    261261
    262     // safely read a shortcut from the preferences
    263     private static String[] getConfigStringArray(String key) {
    264         String s = Main.pref.get(key, null);
    265         if (s == null || s.equals("null") || s.equals(""))
    266             return null;
    267         return s.split(";");
    268     }
    269 
    270262    // bootstrap
    271263    private static boolean initdone = false;
Note: See TracChangeset for help on using the changeset viewer.