Changeset 340 in josm for branch/0.5/src


Ignore:
Timestamp:
2007-10-04T23:41:26+02:00 (17 years ago)
Author:
framm
Message:
  • merged in JOSM render speed patch by Brent Easton
  • merged in Imi's changes to remove eigenheimstrasse.de references
  • merged in the plugin download whitespace stripping bugfix
Location:
branch/0.5/src/org/openstreetmap/josm
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • branch/0.5/src/org/openstreetmap/josm/actions/HelpAction.java

    r298 r340  
    4747
    4848        private JFrame helpBrowser = new JFrame("JOSM Online Help");
    49         private String baseurl = Main.pref.get("help.baseurl", "http://josm.eigenheimstrasse.de");
     49        private String baseurl = Main.pref.get("help.baseurl", "http://josm.openstreetmap.de");
    5050        private JEditorPane help = new JEditorPane();
    5151        private WikiReader reader = new WikiReader(baseurl);
  • branch/0.5/src/org/openstreetmap/josm/data/osm/visitor/SimplePaintVisitor.java

    r329 r340  
    44import java.awt.Color;
    55import java.awt.Graphics;
     6import java.awt.Graphics2D;
    67import java.awt.Point;
    78import java.awt.Rectangle;
     9import java.awt.geom.GeneralPath;
    810import java.awt.geom.Line2D;
    911
     
    4143
    4244        protected static final double PHI = Math.toRadians(20);
     45       
     46        /**
     47         * Preferences
     48        */
     49        protected Color inactiveColor;
     50        protected Color selectedColor;
     51        protected Color nodeColor;
     52        protected Color dfltWayColor;
     53        protected Color incompleteColor;
     54        protected Color backgroundColor;
     55        protected boolean showDirectionArrow;
     56        protected boolean showOrderNumber;
     57       
     58        /**
     59         * Draw subsequent segments of same color as one Path
     60         */
     61        protected Color currentColor = null;
     62        protected GeneralPath currentPath = new GeneralPath();
    4363
    4464        public void visitAll(DataSet data) {
     65               
     66                inactiveColor = getPreferencesColor("inactive", Color.DARK_GRAY);
     67                selectedColor = getPreferencesColor("selected", Color.WHITE);
     68                nodeColor = getPreferencesColor("node", Color.RED);
     69                dfltWayColor = getPreferencesColor("way", darkblue);
     70                incompleteColor = getPreferencesColor("incomplete way", darkerblue);
     71                backgroundColor = getPreferencesColor("background", Color.BLACK);
     72                showDirectionArrow = Main.pref.getBoolean("draw.segment.direction");
     73                showOrderNumber = Main.pref.getBoolean("draw.segment.order_number");
     74               
    4575                for (final OsmPrimitive osm : data.ways)
    4676                        if (!osm.deleted && !osm.selected)
    4777                                osm.visit(this);
     78                displaySegments(null);
    4879                for (final OsmPrimitive osm : data.nodes)
    4980                        if (!osm.deleted && !osm.selected)
     
    5283                        if (!osm.deleted)
    5384                                osm.visit(this);
     85                displaySegments(null);
    5486        }
    5587
     
    6395                Color color = null;
    6496                if (inactive)
    65                         color = getPreferencesColor("inactive", Color.DARK_GRAY);
     97                        color = inactiveColor;
    6698                else if (n.selected)
    67                         color = getPreferencesColor("selected", Color.WHITE);
     99                        color = selectedColor;
    68100                else
    69                         color = getPreferencesColor("node", Color.RED);
     101                        color = nodeColor;
    70102                drawNode(n, color);
    71103        }
     
    78110                Color wayColor;
    79111                if (inactive)
    80                         wayColor = getPreferencesColor("inactive", Color.DARK_GRAY);
     112                        wayColor = inactiveColor;
    81113                else {
    82                         wayColor = getPreferencesColor("way", darkblue);
    83                 }
    84 
    85                 boolean showDirectionArrow = Main.pref.getBoolean("draw.segment.direction");
    86                 boolean showOrderNumber = Main.pref.getBoolean("draw.segment.order_number");
     114                        wayColor = dfltWayColor;
     115                }
     116
    87117                int orderNumber = 0;
    88118                Node lastN = null;
     
    93123                        }
    94124                        orderNumber++;
    95                         drawSegment(lastN, n, w.selected && !inactive ? getPreferencesColor("selected", Color.WHITE) : wayColor, showDirectionArrow);
     125                        drawSegment(lastN, n, w.selected && !inactive ? selectedColor : wayColor, showDirectionArrow);
    96126                        if (showOrderNumber)
    97127                                drawOrderNumber(lastN, n, orderNumber);
     
    101131
    102132        public void visit(Relation e) {
    103                 // relations are not drawn.
    104         }
     133                // relations are not (yet?) drawn.
     134        }
     135       
    105136        /**
    106137         * Draw an number of the order of the two consecutive nodes within the
     
    117148                if (screen.contains(x,y)) {
    118149                        Color c = g.getColor();
    119                         g.setColor(getPreferencesColor("background", Color.BLACK));
     150                        g.setColor(backgroundColor);
    120151                        g.fillRect(x-1, y-12, 8*strlen+1, 14);
    121152                        g.setColor(c);
     
    135166                Rectangle screen = g.getClipBounds();
    136167
    137                 if ( screen.contains(p.x, p.y) )
     168                if (screen.contains(p.x, p.y))
    138169                        g.drawRect(p.x-1, p.y-1, 2, 2);
    139170        }
     
    152183                {
    153184                        g.drawLine(p1.x, p1.y, p2.x, p2.y);
    154        
     185                        currentPath.moveTo(p1.x, p1.y);
     186                        currentPath.lineTo(p2.x, p2.y);
     187                       
    155188                        if (showDirection) {
    156189                                double t = Math.atan2(p2.y-p1.y, p2.x-p1.x) + Math.PI;
    157                         g.drawLine(p2.x,p2.y, (int)(p2.x + 10*Math.cos(t-PHI)), (int)(p2.y + 10*Math.sin(t-PHI)));
    158                         g.drawLine(p2.x,p2.y, (int)(p2.x + 10*Math.cos(t+PHI)), (int)(p2.y + 10*Math.sin(t+PHI)));
     190                                currentPath.lineTo((int)(p2.x + 10*Math.cos(t-PHI)), (int)(p2.y + 10*Math.sin(t-PHI)));
     191                                currentPath.moveTo((int)(p2.x + 10*Math.cos(t+PHI)), (int)(p2.y + 10*Math.sin(t+PHI)));
     192                                currentPath.lineTo(p2.x, p2.y); 
    159193                        }
    160194                }
     
    169203                return ColorHelper.html2color(colStr);
    170204        }
    171 
    172 
     205       
    173206        public void setGraphics(Graphics g) {
    174207        this.g = g;
     
    178211        this.nc = nc;
    179212    }
     213
     214        protected void displaySegments(Color newColor) {
     215                if (currentPath != null) {
     216                        g.setColor(currentColor);
     217                        ((Graphics2D) g).draw(currentPath);
     218                        currentPath = new GeneralPath();
     219                        currentColor = newColor;
     220                }
     221        }
    180222}
  • branch/0.5/src/org/openstreetmap/josm/gui/ConflictResolver.java

    r329 r340  
    156156                }
    157157               
    158                 if (this.conflicts.isEmpty()) {
    159                         JOptionPane.showMessageDialog(Main.parent,
    160                                         "The ConflictResolver and the Merger disagree about conflicts in your dataset.\n"+
    161                                         "Of course, this is a bug.\n"+
    162                                         "The bug is very old, but unfortunatly, Imi (programmer) was not able to catch it.\n"+
    163                                         "If you know exactly what bounding boxes you downloaded (bookmarks?) and/or what\n"+
    164                                         "files you opened (have them ready?) to display this message again, pretty please\n"+
    165                                         "inform Imi at josm@eigenheimstrasse.de about the details.\n"+
    166                                         "Thanks.");
    167                         //throw new RuntimeException("No conflicts but in conflict list:\n"+Arrays.toString(conflicts.entrySet().toArray()));
    168                 }
    169158
    170159                // have to initialize the JTables here and not in the declaration, because its constructor
  • branch/0.5/src/org/openstreetmap/josm/gui/preferences/TaggingPresetPreference.java

    r298 r340  
    7474                taggingPresetSources.setVisibleRowCount(3);
    7575
    76                 taggingPresetSources.setToolTipText(tr("The sources (url or filename) of tagging preset definition files. See http://josm.eigenheimstrasse.de/wiki/TaggingPresets for help."));
     76                taggingPresetSources.setToolTipText(tr("The sources (url or filename) of tagging preset definition files. See http://josm.openstreetmap.de/wiki/TaggingPresets for help."));
    7777                addAnno.setToolTipText(tr("Add a new tagging preset source to the list."));
    7878                deleteAnno.setToolTipText(tr("Delete the selected source from the list."));
  • branch/0.5/src/org/openstreetmap/josm/tools/XmlObjectParser.java

    r319 r340  
    7070                                report();
    7171                        else if (characters != null && !current.isEmpty()) {
    72                                 setValue(qname, characters);
     72                                setValue(qname, characters.trim());
    7373                                characters = "";
    7474                        }
Note: See TracChangeset for help on using the changeset viewer.