Changeset 2450 in josm for trunk


Ignore:
Timestamp:
2009-11-14T18:47:09+01:00 (14 years ago)
Author:
jttt
Message:

Added parameter Bounds to MapView, draw only currently visible primitives in MapPaintVisititor

Location:
trunk/src/org/openstreetmap/josm
Files:
1 added
19 edited

Legend:

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

    r2412 r2450  
    1111import java.awt.Cursor;
    1212import java.awt.EventQueue;
    13 import java.awt.Graphics;
    1413import java.awt.Graphics2D;
    1514import java.awt.Point;
     
    4140import org.openstreetmap.josm.command.Command;
    4241import org.openstreetmap.josm.command.SequenceCommand;
     42import org.openstreetmap.josm.data.Bounds;
    4343import org.openstreetmap.josm.data.SelectionChangedListener;
    4444import org.openstreetmap.josm.data.coor.EastNorth;
     
    879879    }
    880880
    881     public void paint(Graphics g, MapView mv) {
     881    public void paint(Graphics2D g, MapView mv, Bounds box) {
    882882        if (!drawHelperLine || wayIsFinished || shift) return;
    883883
  • trunk/src/org/openstreetmap/josm/actions/mapmode/ExtrudeAction.java

    r2432 r2450  
    88import java.awt.Color;
    99import java.awt.Cursor;
    10 import java.awt.Graphics;
    1110import java.awt.Graphics2D;
    1211import java.awt.Point;
     
    2928import org.openstreetmap.josm.command.MoveCommand;
    3029import org.openstreetmap.josm.command.SequenceCommand;
     30import org.openstreetmap.josm.data.Bounds;
    3131import org.openstreetmap.josm.data.coor.EastNorth;
    3232import org.openstreetmap.josm.data.osm.Node;
     
    230230    }
    231231
    232     public void paint(Graphics g, MapView mv) {
     232    public void paint(Graphics2D g, MapView mv, Bounds box) {
    233233        if (mode == Mode.select) {
    234234            // Nothing to do
  • trunk/src/org/openstreetmap/josm/data/osm/DataSet.java

    r2439 r2450  
    2020
    2121import org.openstreetmap.josm.data.SelectionChangedListener;
    22 import org.openstreetmap.josm.data.osm.QuadBuckets.BBox;
    2322
    2423/**
  • trunk/src/org/openstreetmap/josm/data/osm/Node.java

    r2437 r2450  
    55import org.openstreetmap.josm.data.coor.EastNorth;
    66import org.openstreetmap.josm.data.coor.LatLon;
    7 import org.openstreetmap.josm.data.osm.QuadBuckets.BBox;
    87import org.openstreetmap.josm.data.osm.visitor.Visitor;
    98
  • trunk/src/org/openstreetmap/josm/data/osm/OsmPrimitive.java

    r2448 r2450  
    1919
    2020import org.openstreetmap.josm.Main;
    21 import org.openstreetmap.josm.data.osm.QuadBuckets.BBox;
    2221import org.openstreetmap.josm.data.osm.visitor.Visitor;
    2322import org.openstreetmap.josm.gui.mappaint.ElemStyle;
     
    219218     * @param disabled true, if this primitive is disabled; false, otherwise
    220219     */
    221     public void setDisabled(boolean disabled) {
     220    void setDisabled(boolean disabled) {
    222221        if (disabled) {
    223222            flags |= FLAG_DISABLED;
  • trunk/src/org/openstreetmap/josm/data/osm/QuadBuckets.java

    r2449 r2450  
    5858    public static double WORLD_PARTS = (1 << NR_LEVELS);
    5959
    60     public static int MAX_OBJECTS_PER_LEVEL = 16;
    61     // has to be a power of 2
    62     public static int TILES_PER_LEVEL_SHIFT = 2;
    63     public static int TILES_PER_LEVEL = 1<<TILES_PER_LEVEL_SHIFT;
    64     // Maybe this should just be a Rectangle??
    65     public static class BBox
    66     {
    67         private double xmin = Double.POSITIVE_INFINITY;
    68         private double xmax = Double.NEGATIVE_INFINITY;
    69         private double ymin = Double.POSITIVE_INFINITY;
    70         private double ymax = Double.NEGATIVE_INFINITY;
    71         void sanity()
    72         {
    73             if (xmin < -180.0) {
    74                 xmin = -180.0;
    75             }
    76             if (xmax >  180.0) {
    77                 xmax =  180.0;
    78             }
    79             if (ymin <  -90.0) {
    80                 ymin =  -90.0;
    81             }
    82             if (ymax >   90.0) {
    83                 ymax =   90.0;
    84             }
    85             if ((xmin < -180.0) ||
    86                     (xmax >  180.0) ||
    87                     (ymin <  -90.0) ||
    88                     (ymax >   90.0))
    89                 throw new IllegalArgumentException("bad BBox: " + this);
    90         }
    91         @Override
    92         public String toString()
    93         {
    94             return "[ x: " + xmin + " -> " + xmax +
    95             ", y: " + ymin + " -> " + ymax + " ]";
    96         }
    97         double min(double a, double b)
    98         {
    99             if (a < b)
    100                 return a;
    101             return b;
    102         }
    103         double max(double a, double b)
    104         {
    105             if (a > b)
    106                 return a;
    107             return b;
    108         }
    109         private void add(LatLon c)
    110         {
    111             xmin = min(xmin, c.lon());
    112             xmax = max(xmax, c.lon());
    113             ymin = min(ymin, c.lat());
    114             ymax = max(ymax, c.lat());
    115         }
    116         public BBox(LatLon a, LatLon b)
    117         {
    118             add(a);
    119             add(b);
    120             sanity();
    121         }
    122         public BBox(double a_x, double a_y, double b_x, double b_y)
    123         {
    124             xmin = min(a_x, b_x);
    125             xmax = max(a_x, b_x);
    126             ymin = min(a_y, b_y);
    127             ymax = max(a_y, b_y);
    128             sanity();
    129         }
    130         public BBox(Way w)
    131         {
    132             for (Node n : w.getNodes()) {
    133                 LatLon coor = n.getCoor();
    134                 if (coor == null) {
    135                     continue;
    136                 }
    137                 add(coor);
    138             }
    139             this.sanity();
    140         }
    141         public double height()
    142         {
    143             return ymax-ymin;
    144         }
    145         public double width()
    146         {
    147             return xmax-xmin;
    148         }
    149         boolean bounds(BBox b)
    150         {
    151             if (!(xmin <= b.xmin) ||
    152                     !(xmax >= b.xmax) ||
    153                     !(ymin <= b.ymin) ||
    154                     !(ymax >= b.ymax))
    155                 return false;
    156             return true;
    157         }
    158         boolean bounds(LatLon c)
    159         {
    160             if ((xmin <= c.lon()) &&
    161                     (xmax >= c.lon()) &&
    162                     (ymin <= c.lat()) &&
    163                     (ymax >= c.lat()))
    164                 return true;
    165             return false;
    166         }
    167         boolean inside(BBox b)
    168         {
    169             if (xmin >= b.xmax)
    170                 return false;
    171             if (xmax <= b.xmin)
    172                 return false;
    173             if (ymin >= b.ymax)
    174                 return false;
    175             if (ymax <= b.ymin)
    176                 return false;
    177             return true;
    178         }
    179         boolean intersects(BBox b)
    180         {
    181             return this.inside(b) || b.inside(this);
    182         }
    183         List<LatLon> points()
    184         {
    185             LatLon p1 = new LatLon(ymin, xmin);
    186             LatLon p2 = new LatLon(ymin, xmax);
    187             LatLon p3 = new LatLon(ymax, xmin);
    188             LatLon p4 = new LatLon(ymax, xmax);
    189             List<LatLon> ret = new ArrayList<LatLon>();
    190             ret.add(p1);
    191             ret.add(p2);
    192             ret.add(p3);
    193             ret.add(p4);
    194             return ret;
    195         }
    196     }
     60    public static int MAX_OBJECTS_PER_LEVEL = 2;
    19761    class QBLevel
    19862    {
     
    294158                    continue;
    295159                }
    296                 if (children == null)
     160                if (children == null) {
    297161                    children = newChildren();
     162                }
    298163                if (children[new_index] == null) {
    299164                    children[new_index] = new QBLevel(this, new_index);
     
    725590        public BBox bbox()
    726591        {
    727             if (bbox != null) {
    728                 bbox.sanity();
     592            if (bbox != null)
    729593                return bbox;
    730             }
    731594            if (level == 0) {
    732595                bbox = new BBox(-180, 90, 180, -90);
     
    738601                bbox = new BBox(bottom_left, top_right);
    739602            }
    740             bbox.sanity();
    741603            return bbox;
    742604        }
     
    1100962            out("search bbox before sanity: " +  bbox);
    1101963        }
    1102         bbox.sanity();
    1103964        if (debug) {
    1104965            out("search bbox after sanity: " +  bbox);
     
    1124985    {
    1125986        BBox bbox = new BBox(b1.lon(), b1.lat(), b2.lon(), b2.lat());
    1126         bbox.sanity();
    1127987        return this.search(bbox);
    1128988    }
  • trunk/src/org/openstreetmap/josm/data/osm/Relation.java

    r2439 r2450  
    77import java.util.Set;
    88
    9 import org.openstreetmap.josm.data.osm.QuadBuckets.BBox;
    109import org.openstreetmap.josm.data.osm.visitor.Visitor;
    1110import org.openstreetmap.josm.tools.CopyList;
  • trunk/src/org/openstreetmap/josm/data/osm/Way.java

    r2437 r2450  
    99import java.util.List;
    1010
    11 import org.openstreetmap.josm.data.osm.QuadBuckets.BBox;
    1211import org.openstreetmap.josm.data.osm.visitor.Visitor;
    1312import org.openstreetmap.josm.tools.CopyList;
  • trunk/src/org/openstreetmap/josm/data/osm/visitor/MapPaintVisitor.java

    r2392 r2450  
    3232
    3333import org.openstreetmap.josm.Main;
     34import org.openstreetmap.josm.data.Bounds;
    3435import org.openstreetmap.josm.data.coor.EastNorth;
    3536import org.openstreetmap.josm.data.coor.LatLon;
     37import org.openstreetmap.josm.data.osm.BBox;
    3638import org.openstreetmap.josm.data.osm.DataSet;
    3739import org.openstreetmap.josm.data.osm.Node;
     
    114116            return (styles != null) ? styles.getIcon(osm) : null;
    115117
    116         if(osm.mappaintStyle == null && styles != null) {
    117             osm.mappaintStyle = styles.getIcon(osm);
    118         }
    119 
    120         return (IconElemStyle)osm.mappaintStyle;
     118            if(osm.mappaintStyle == null && styles != null) {
     119                osm.mappaintStyle = styles.getIcon(osm);
     120            }
     121
     122            return (IconElemStyle)osm.mappaintStyle;
    121123    }
    122124
     
    14451447    /* Shows areas before non-areas */
    14461448    @Override
    1447     public void visitAll(DataSet data, Boolean virtual) {
     1449    public void visitAll(DataSet data, boolean virtual, Bounds bounds) {
     1450        BBox bbox = new BBox(bounds);
    14481451        this.data = data;
    14491452        //boolean profiler = Main.pref.getBoolean("mappaint.profiler",false);
     
    15211524            /*** AREAS ***/
    15221525            //    profilerN = 0;
    1523             for (final Way osm : selectedLast(data, data.getWays())) {
     1526            for (final Way osm : selectedLast(data, data.searchWays(bbox))) {
    15241527                if (drawable(osm)
    15251528                        && osm.mappaintVisibleCode != viewid && osm.mappaintDrawnCode != paintid) {
     
    16141617        /*** NODES ***/
    16151618        //profilerN = 0;
    1616         for (final Node osm: data.getNodes()) {
     1619        for (final Node osm: data.searchNodes(bbox)) {
    16171620            if (!osm.incomplete && !osm.isDeleted() && (data.isSelected(osm) || !osm.isFiltered())
    16181621                    && osm.mappaintVisibleCode != viewid && osm.mappaintDrawnCode != paintid)
     
    16341637            //    profilerN = 0;
    16351638            currentColor = nodeColor;
    1636             for (final OsmPrimitive osm: data.getWays()) {
     1639            for (final OsmPrimitive osm: data.searchWays(bbox)) {
    16371640                if (osm.isUsable() && !osm.isFiltered()
    16381641                        && osm.mappaintVisibleCode != viewid )
  • trunk/src/org/openstreetmap/josm/data/osm/visitor/SimplePaintVisitor.java

    r2381 r2450  
    1919
    2020import org.openstreetmap.josm.Main;
     21import org.openstreetmap.josm.data.Bounds;
    2122import org.openstreetmap.josm.data.osm.DataSet;
    2223import org.openstreetmap.josm.data.osm.Node;
     
    129130
    130131    DataSet ds;
    131     public void visitAll(DataSet data, Boolean virtual) {
     132    public void visitAll(DataSet data, boolean virtual, Bounds bounds) {
    132133        this.ds = data;
    133134        //boolean profiler = Main.pref.getBoolean("simplepaint.profiler",false);
  • trunk/src/org/openstreetmap/josm/gui/MapView.java

    r2446 r2450  
    5050import org.openstreetmap.josm.gui.layer.markerlayer.PlayHeadMarker;
    5151import org.openstreetmap.josm.tools.AudioPlayer;
     52
    5253
    5354/**
     
    385386        tempG.fillRect(0, 0, getWidth(), getHeight());
    386387
     388        Bounds box = getLatLonBounds(g.getClipBounds());
     389
    387390        for (Layer l: getVisibleLayersInZOrder()) {
    388             l.paint(tempG, this);
     391            l.paint(tempG, this, box);
    389392        }
    390393        for (MapViewPaintable mvp : temporaryLayers) {
    391             mvp.paint(tempG, this);
     394            mvp.paint(tempG, this, box);
    392395        }
    393396
  • trunk/src/org/openstreetmap/josm/gui/NavigatableComponent.java

    r2426 r2450  
    44
    55import java.awt.Point;
     6import java.awt.Rectangle;
    67import java.util.ArrayList;
    78import java.util.Collection;
     
    2021import org.openstreetmap.josm.data.coor.EastNorth;
    2122import org.openstreetmap.josm.data.coor.LatLon;
     23import org.openstreetmap.josm.data.osm.BBox;
    2224import org.openstreetmap.josm.data.osm.DataSet;
    2325import org.openstreetmap.josm.data.osm.Node;
     
    2527import org.openstreetmap.josm.data.osm.Way;
    2628import org.openstreetmap.josm.data.osm.WaySegment;
    27 import org.openstreetmap.josm.data.osm.QuadBuckets.BBox;
    2829import org.openstreetmap.josm.data.projection.Projection;
    2930import org.openstreetmap.josm.gui.help.Helpful;
     
    154155    public LatLon getLatLon(int x, int y) {
    155156        return getProjection().eastNorth2latlon(getEastNorth(x, y));
     157    }
     158
     159    /**
     160     * @param r
     161     * @return Minimum bounds that will cover rectangle
     162     */
     163    public Bounds getLatLonBounds(Rectangle r) {
     164        // TODO Maybe this should be (optional) method of Projection implementation
     165        EastNorth p1 = getEastNorth(r.x, r.y);
     166        EastNorth p2 = getEastNorth(r.x + r.width, r.y + r.height);
     167
     168        Bounds result = new Bounds(Main.proj.eastNorth2latlon(p1));
     169
     170        double eastMin = Math.min(p1.east(), p2.east());
     171        double eastMax = Math.max(p1.east(), p2.east());
     172        double northMin = Math.min(p1.north(), p2.north());
     173        double northMax = Math.min(p1.north(), p2.north());
     174        double deltaEast = (eastMax - eastMin) / 10;
     175        double deltaNorth = (northMax - northMin) / 10;
     176
     177        for (int i=0; i < 10; i++) {
     178            result.extend(Main.proj.eastNorth2latlon(new EastNorth(eastMin + i * deltaEast, northMin)));
     179            result.extend(Main.proj.eastNorth2latlon(new EastNorth(eastMin + i * deltaEast, northMax)));
     180            result.extend(Main.proj.eastNorth2latlon(new EastNorth(eastMin, northMin  + i * deltaNorth)));
     181            result.extend(Main.proj.eastNorth2latlon(new EastNorth(eastMax, northMin  + i * deltaNorth)));
     182        }
     183
     184        return result;
    156185    }
    157186
  • trunk/src/org/openstreetmap/josm/gui/layer/GeoImageLayer.java

    r2322 r2450  
    99import java.awt.Component;
    1010import java.awt.Cursor;
    11 import java.awt.Graphics;
    1211import java.awt.Graphics2D;
    1312import java.awt.GridBagLayout;
     
    6362import org.openstreetmap.josm.Main;
    6463import org.openstreetmap.josm.actions.RenameLayerAction;
     64import org.openstreetmap.josm.data.Bounds;
    6565import org.openstreetmap.josm.data.coor.CachedLatLon;
    6666import org.openstreetmap.josm.data.coor.LatLon;
     
    641641    }
    642642
    643     @Override public void paint(Graphics g, MapView mv) {
     643    @Override public void paint(Graphics2D g, MapView mv, Bounds box) {
    644644        int clickedIndex = -1;
    645645
  • trunk/src/org/openstreetmap/josm/gui/layer/GpxLayer.java

    r2381 r2450  
    1010import java.awt.Color;
    1111import java.awt.Component;
    12 import java.awt.Graphics;
    1312import java.awt.Graphics2D;
    1413import java.awt.GridBagLayout;
     
    4948import org.openstreetmap.josm.actions.RenameLayerAction;
    5049import org.openstreetmap.josm.actions.downloadtasks.DownloadOsmTaskList;
     50import org.openstreetmap.josm.data.Bounds;
    5151import org.openstreetmap.josm.data.coor.EastNorth;
    5252import org.openstreetmap.josm.data.coor.LatLon;
     
    143143                        tr("Select line drawing options"), JOptionPane.OK_CANCEL_OPTION, JOptionPane.QUESTION_MESSAGE);
    144144                switch (answer) {
    145                     case JOptionPane.CANCEL_OPTION:
    146                     case JOptionPane.CLOSED_OPTION:
    147                         return;
    148                     default:
    149                         // continue
     145                case JOptionPane.CANCEL_OPTION:
     146                case JOptionPane.CLOSED_OPTION:
     147                    return;
     148                default:
     149                    // continue
    150150                }
    151151                if (group.getSelection() == r[0].getModel()) {
     
    174174                );
    175175                switch (answer) {
    176                     case 0:
    177                         Main.pref.putColor("layer " + getName(), c.getColor());
    178                         break;
    179                     case 1:
    180                         return;
    181                     case 2:
    182                         Main.pref.putColor("layer " + getName(), null);
    183                         break;
     176                case 0:
     177                    Main.pref.putColor("layer " + getName(), c.getColor());
     178                    break;
     179                case 1:
     180                    return;
     181                case 2:
     182                    Main.pref.putColor("layer " + getName(), null);
     183                    break;
    184184                }
    185185                Main.map.repaint();
     
    444444
    445445    @Override
    446     public void paint(Graphics g, MapView mv) {
     446    public void paint(Graphics2D g, MapView mv, Bounds box) {
    447447
    448448        /****************************************************************
     
    490490        if(lineWidth != 0)
    491491        {
    492             Graphics2D g2d = (Graphics2D)g;
    493             g2d.setStroke(new BasicStroke(lineWidth,BasicStroke.CAP_ROUND,BasicStroke.JOIN_ROUND));
     492            g.setStroke(new BasicStroke(lineWidth,BasicStroke.CAP_ROUND,BasicStroke.JOIN_ROUND));
    494493        }
    495494
     
    531530
    532531                            switch (colored) {
    533                                 case velocity:
    534                                     double dtime = trkPnt.time - oldWp.time;
    535                                     double vel = dist / dtime;
    536                                     double velColor = vel / colorTracksTune * 255;
    537                                     // Bad case first
    538                                     if (dtime <= 0 || vel < 0 || velColor > 255) {
    539                                         trkPnt.customColoring = colors[255];
    540                                     } else {
    541                                         trkPnt.customColoring = colors[(int) (velColor)];
     532                            case velocity:
     533                                double dtime = trkPnt.time - oldWp.time;
     534                                double vel = dist / dtime;
     535                                double velColor = vel / colorTracksTune * 255;
     536                                // Bad case first
     537                                if (dtime <= 0 || vel < 0 || velColor > 255) {
     538                                    trkPnt.customColoring = colors[255];
     539                                } else {
     540                                    trkPnt.customColoring = colors[(int) (velColor)];
     541                                }
     542                                break;
     543
     544                            case dilution:
     545                                if (trkPnt.attr.get("hdop") != null) {
     546                                    float hdop = ((Float) trkPnt.attr.get("hdop")).floatValue();
     547                                    if (hdop < 0) {
     548                                        hdop = 0;
    542549                                    }
    543                                     break;
    544 
    545                                 case dilution:
    546                                     if (trkPnt.attr.get("hdop") != null) {
    547                                         float hdop = ((Float) trkPnt.attr.get("hdop")).floatValue();
    548                                         if (hdop < 0) {
    549                                             hdop = 0;
    550                                         }
    551                                         int hdoplvl = Math.round(hdop * Main.pref.getInteger("hdop.factor", 25));
    552                                         // High hdop is bad, but high values in colors are green.
    553                                         // Therefore inverse the logic
    554                                         int hdopcolor = 255 - (hdoplvl > 255 ? 255 : hdoplvl);
    555                                         trkPnt.customColoring = colors[hdopcolor];
    556                                     }
    557                                     break;
     550                                    int hdoplvl = Math.round(hdop * Main.pref.getInteger("hdop.factor", 25));
     551                                    // High hdop is bad, but high values in colors are green.
     552                                    // Therefore inverse the logic
     553                                    int hdopcolor = 255 - (hdoplvl > 255 ? 255 : hdoplvl);
     554                                    trkPnt.customColoring = colors[hdopcolor];
     555                                }
     556                                break;
    558557                            }
    559558
     
    838837            );
    839838            switch(ret) {
    840                 case JOptionPane.CANCEL_OPTION:
    841                 case JOptionPane.CLOSED_OPTION:
    842                     return;
    843                 default:
    844                     // continue
     839            case JOptionPane.CANCEL_OPTION:
     840            case JOptionPane.CLOSED_OPTION:
     841                return;
     842            default:
     843                // continue
    845844            }
    846845
     
    936935                );
    937936                switch(ret) {
    938                     case JOptionPane.CANCEL_OPTION:
    939                     case JOptionPane.CLOSED_OPTION:
    940                         return;
    941                     default:
    942                         // continue
     937                case JOptionPane.CANCEL_OPTION:
     938                case JOptionPane.CLOSED_OPTION:
     939                    return;
     940                default:
     941                    // continue
    943942                }
    944943            }
  • trunk/src/org/openstreetmap/josm/gui/layer/Layer.java

    r2192 r2450  
    66
    77import java.awt.Component;
    8 import java.awt.Graphics;
     8import java.awt.Graphics2D;
    99import java.awt.event.ActionEvent;
    1010import java.beans.PropertyChangeListener;
     
    2020import org.openstreetmap.josm.actions.SaveAction;
    2121import org.openstreetmap.josm.actions.SaveAsAction;
     22import org.openstreetmap.josm.data.Bounds;
    2223import org.openstreetmap.josm.data.osm.visitor.BoundingXYVisitor;
    2324import org.openstreetmap.josm.gui.MapView;
     
    9899     * @param mv The object that can translate GeoPoints to screen coordinates.
    99100     */
    100     abstract public void paint(Graphics g, MapView mv);
     101    abstract public void paint(Graphics2D g, MapView mv, Bounds box);
    101102    /**
    102103     * Return a representative small image for this layer. The image must not
  • trunk/src/org/openstreetmap/josm/gui/layer/MapViewPaintable.java

    r1169 r2450  
    22package org.openstreetmap.josm.gui.layer;
    33
    4 import java.awt.Graphics;
     4import java.awt.Graphics2D;
    55
     6import org.openstreetmap.josm.data.Bounds;
    67import org.openstreetmap.josm.gui.MapView;
    78
     
    1213     * @param mv The object that can translate GeoPoints to screen coordinates.
    1314     */
    14     abstract public void paint(Graphics g, MapView mv);
     15    void paint(Graphics2D g, MapView mv, Bounds bbox);
    1516
    1617}
  • trunk/src/org/openstreetmap/josm/gui/layer/OsmDataLayer.java

    r2434 r2450  
    1212import java.awt.Component;
    1313import java.awt.Composite;
    14 import java.awt.Graphics;
    1514import java.awt.Graphics2D;
    1615import java.awt.GridBagLayout;
     
    4039import org.openstreetmap.josm.actions.RenameLayerAction;
    4140import org.openstreetmap.josm.command.PurgePrimitivesCommand;
     41import org.openstreetmap.josm.data.Bounds;
    4242import org.openstreetmap.josm.data.conflict.Conflict;
    4343import org.openstreetmap.josm.data.conflict.ConflictCollection;
     
    204204     * Draw nodes last to overlap the ways they belong to.
    205205     */
    206     @Override public void paint(final Graphics g, final MapView mv) {
     206    @Override public void paint(final Graphics2D g, final MapView mv, Bounds box) {
    207207        boolean active = mv.getActiveLayer() == this;
    208208        boolean inactive = !active && Main.pref.getBoolean("draw.data.inactive_color", true);
     
    245245        painter.setNavigatableComponent(mv);
    246246        painter.inactive = inactive;
    247         painter.visitAll(data, virtual);
     247        painter.visitAll(data, virtual, box);
    248248        Main.map.conflictDialog.paintConflicts(g, mv);
    249249    }
  • trunk/src/org/openstreetmap/josm/gui/layer/RawGpsLayer.java

    r2381 r2450  
    99import java.awt.Color;
    1010import java.awt.Component;
    11 import java.awt.Graphics;
     11import java.awt.Graphics2D;
    1212import java.awt.GridBagLayout;
    1313import java.awt.Point;
     
    3333import org.openstreetmap.josm.Main;
    3434import org.openstreetmap.josm.actions.RenameLayerAction;
     35import org.openstreetmap.josm.data.Bounds;
    3536import org.openstreetmap.josm.data.Preferences.PreferenceChangedListener;
    3637import org.openstreetmap.josm.data.coor.EastNorth;
     
    122123    }
    123124
    124     @Override public void paint(Graphics g, MapView mv) {
     125    @Override public void paint(Graphics2D g, MapView mv, Bounds box) {
    125126        g.setColor(Main.pref.getColor(marktr("gps point"), "layer "+getName(), Color.gray));
    126127        Point old = null;
     
    244245                        JOptionPane.PLAIN_MESSAGE, null,options, options[0]);
    245246                switch (answer) {
    246                     case 0:
    247                         Main.pref.putColor("layer "+getName(), c.getColor());
    248                         break;
    249                     case 1:
    250                         return;
    251                     case 2:
    252                         Main.pref.putColor("layer "+getName(), null);
    253                         break;
     247                case 0:
     248                    Main.pref.putColor("layer "+getName(), c.getColor());
     249                    break;
     250                case 1:
     251                    return;
     252                case 2:
     253                    Main.pref.putColor("layer "+getName(), null);
     254                    break;
    254255                }
    255256                Main.map.repaint();
  • trunk/src/org/openstreetmap/josm/gui/layer/markerlayer/MarkerLayer.java

    r2017 r2450  
    88import java.awt.Color;
    99import java.awt.Component;
    10 import java.awt.Graphics;
     10import java.awt.Graphics2D;
    1111import java.awt.Point;
    1212import java.awt.event.ActionEvent;
     
    2929import org.openstreetmap.josm.Main;
    3030import org.openstreetmap.josm.actions.RenameLayerAction;
     31import org.openstreetmap.josm.data.Bounds;
    3132import org.openstreetmap.josm.data.coor.LatLon;
    3233import org.openstreetmap.josm.data.gpx.GpxData;
     
    152153    }
    153154
    154     @Override public void paint(Graphics g, MapView mv) {
     155    @Override public void paint(Graphics2D g, MapView mv, Bounds box) {
    155156        boolean mousePressedTmp = mousePressed;
    156157        Point mousePos = mv.getMousePosition();
     
    210211                );
    211212                switch (answer) {
    212                     case 0:
    213                         Main.pref.putColor("layer "+getName(), c.getColor());
    214                         break;
    215                     case 1:
    216                         return;
    217                     case 2:
    218                         Main.pref.putColor("layer "+getName(), null);
    219                         break;
     213                case 0:
     214                    Main.pref.putColor("layer "+getName(), c.getColor());
     215                    break;
     216                case 1:
     217                    return;
     218                case 2:
     219                    Main.pref.putColor("layer "+getName(), null);
     220                    break;
    220221                }
    221222                Main.map.repaint();
Note: See TracChangeset for help on using the changeset viewer.