Changeset 18593 in osm for applications/editors


Ignore:
Timestamp:
2009-11-14T19:27:50+01:00 (15 years ago)
Author:
jttt
Message:

Updated to new MapViewPaintable.paint arguments

Location:
applications/editors/josm/plugins
Files:
15 edited

Legend:

Unmodified
Added
Removed
  • applications/editors/josm/plugins/agpifoj/.classpath

    r16603 r18593  
    22<classpath>
    33        <classpathentry kind="src" path="src"/>
    4         <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
     4        <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JDK 5"/>
    55        <classpathentry combineaccessrules="false" kind="src" path="/JOSM"/>
     6        <classpathentry kind="lib" path="/JOSM/lib/metadata-extractor-2.3.1-nosun.jar"/>
    67        <classpathentry kind="output" path="bin"/>
    78</classpath>
  • applications/editors/josm/plugins/agpifoj/build.xml

    r18287 r18593  
    3434                <attribute name="Plugin-Early" value="false"/>
    3535                <attribute name="Plugin-Link" value="http://wiki.openstreetmap.org/index.php/JOSM/Plugins/AgPifoJ"/>
    36                 <attribute name="Plugin-Mainversion" value="2322"/>
     36                <attribute name="Plugin-Mainversion" value="2450"/>
    3737                <attribute name="Plugin-Version" value="${version.entry.commit.revision}"/>
    3838            </manifest>
  • applications/editors/josm/plugins/agpifoj/src/org/openstreetmap/josm/plugins/agpifoj/AgpifojLayer.java

    r18287 r18593  
    99
    1010import java.awt.Component;
    11 import java.awt.Graphics;
     11import java.awt.Graphics2D;
    1212import java.awt.Point;
    1313import java.awt.Rectangle;
     
    3131import org.openstreetmap.josm.Main;
    3232import org.openstreetmap.josm.actions.RenameLayerAction;
     33import org.openstreetmap.josm.data.Bounds;
    3334import org.openstreetmap.josm.data.coor.CachedLatLon;
    3435import org.openstreetmap.josm.data.coor.LatLon;
     
    109110                this.errorMessages.add(message);
    110111        }
    111        
     112
    112113        public Loader(File[] selection) {
    113114            super(tr("Extracting GPS locations from EXIF"));
    114115            this.selection = selection;
    115             errorMessages = new LinkedHashSet<String>(); 
     116            errorMessages = new LinkedHashSet<String>();
    116117        }
    117118
     
    122123            try {
    123124                addRecursiveFiles(files, selection);
    124             } catch(NullPointerException npe) {                 
     125            } catch(NullPointerException npe) {
    125126                rememberError(tr("One of the selected files was null"));
    126127            }
     
    128129            if (cancelled) {
    129130                return;
    130             }           
     131            }
    131132            progressMonitor.subTask(tr("Read photos..."));
    132133            progressMonitor.setTicksCount(files.size());
     
    200201                        } catch(NullPointerException npe) {
    201202                            npe.printStackTrace();
    202                            
     203
    203204                            rememberError(tr("Found null file in directory {0}\n", f.getPath()));
    204205                        }
     
    232233                return sb.toString();
    233234        }
    234        
     235
    235236        @Override protected void finish() {
    236237                if (!errorMessages.isEmpty()) {
     
    361362
    362363    @Override
    363     public void paint(Graphics g, MapView mv) {
     364    public void paint(Graphics2D g, MapView mv, Bounds bounds) {
    364365
    365366        int iconWidth = icon.getIconWidth() / 2;
  • applications/editors/josm/plugins/agpifoj/src/org/openstreetmap/josm/plugins/agpifoj/CorrelateGpxWithImages.java

    r17526 r18593  
    9696        }
    9797
    98         public String toString() {
     98        @Override
     99                public String toString() {
    99100            return name;
    100101        }
     
    172173                    x.printStackTrace();
    173174                    JOptionPane.showMessageDialog(
    174                                 Main.parent, 
     175                                Main.parent,
    175176                                tr("Error while parsing {0}",sel.getName())+": "+x.getMessage(),
    176177                                tr("Error"),
     
    181182                    x.printStackTrace();
    182183                    JOptionPane.showMessageDialog(
    183                                 Main.parent, 
     184                                Main.parent,
    184185                                tr("Could not read \"{0}\"",sel.getName())+"\n"+x.getMessage(),
    185186                                tr("Error"),
     
    386387            while (! isOk) {
    387388                int answer = JOptionPane.showConfirmDialog(
    388                                 Main.parent, panel, 
    389                                 tr("Synchronize time from a photo of the GPS receiver"), 
     389                                Main.parent, panel,
     390                                tr("Synchronize time from a photo of the GPS receiver"),
    390391                                JOptionPane.OK_CANCEL_OPTION,
    391392                                JOptionPane.QUESTION_MESSAGE
     
    637638        // Search whether an other layer has yet defined some bounding box.
    638639        // If none, we'll zoom to the bounding box of the layer with the photos.
    639         Collection<Layer> layerCol = Main.map.mapView.getAllLayers();
    640         Iterator<Layer> layerIter = layerCol.iterator();
    641640        boolean boundingBoxedLayerFound = false;
    642         while (layerIter.hasNext()) {
    643             Layer l = layerIter.next();
     641        for (Layer l: Main.map.mapView.getAllLayers()) {
    644642            if (l != yLayer) {
    645643                BoundingXYVisitor bbox = new BoundingXYVisitor();
     
    657655        }
    658656
    659         Main.main.map.repaint();
     657        Main.map.repaint();
    660658
    661659        JOptionPane.showMessageDialog(Main.parent, tr("Found {0} matches of {1} in GPX track {2}", matched, dateImgLst.size(), selectedGpx.name),
     
    886884        ExtendedDialog d = new ExtendedDialog(Main.parent,
    887885            tr("Adjust timezone and offset"),
    888             new String[] { tr("Close"),  tr("Default Values") }           
     886            new String[] { tr("Close"),  tr("Default Values") }
    889887        );
    890888
  • applications/editors/josm/plugins/graphview/build.xml

    r18415 r18593  
    5757                <attribute name="Plugin-Description" value="Visualizes routing information as a routing graph."/>
    5858                <attribute name="Plugin-Link" value="http://wiki.openstreetmap.org/index.php/JOSM/Plugins/Graphview"/>
    59                 <attribute name="Plugin-Mainversion" value="2381"/>
     59                <attribute name="Plugin-Mainversion" value="2450"/>
    6060                <attribute name="Plugin-Version" value="${version.entry.commit.revision}"/>
    6161            </manifest>
  • applications/editors/josm/plugins/graphview/src/org/openstreetmap/josm/plugins/graphview/plugin/layer/GraphViewLayer.java

    r18130 r18593  
    1919import org.openstreetmap.josm.Main;
    2020import org.openstreetmap.josm.actions.RenameLayerAction;
     21import org.openstreetmap.josm.data.Bounds;
    2122import org.openstreetmap.josm.data.coor.EastNorth;
    2223import org.openstreetmap.josm.data.coor.LatLon;
     
    148149
    149150                List<Segment> edgeSegments = e.getPropertyValue(GraphEdgeSegments.PROPERTY);
    150                
     151
    151152                if (edgeSegments.size() > 0) {
    152153
     
    283284
    284285        @Override
    285         public void paint(final Graphics g, final MapView mv) {
    286 
    287                 assert g instanceof Graphics2D;
    288                 Graphics2D g2D = ((Graphics2D)g);
    289 
     286        public void paint(final Graphics2D g, final MapView mv, Bounds bounds) {
    290287                if (wayGraph != null) {
    291288
     
    295292
    296293                        for (GraphEdge e : wayGraph.getEdges()) {
    297                                 paintGraphEdge(e, g2D, mv);
     294                                paintGraphEdge(e, g, mv);
    298295                        }
    299296
  • applications/editors/josm/plugins/slippymap/.classpath

    r5674 r18593  
    22<classpath>
    33        <classpathentry kind="src" path="src"/>
    4         <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
    5         <classpathentry combineaccessrules="false" kind="src" path="/josm"/>
     4        <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JDK 5"/>
     5        <classpathentry combineaccessrules="false" kind="src" path="/JOSM"/>
    66        <classpathentry kind="output" path="build"/>
    77</classpath>
  • applications/editors/josm/plugins/slippymap/build.xml

    r18485 r18593  
    2626                <attribute name="Plugin-Description" value="Displays a slippy map grid in JOSM. Can load tiles from slippy map as background and request updates."/>
    2727                <attribute name="Plugin-Link" value="http://wiki.openstreetmap.org/index.php/JOSM/Plugins/SlippyMap"/>
    28                 <attribute name="Plugin-Mainversion" value="2351"/>
     28                <attribute name="Plugin-Mainversion" value="2450"/>
    2929                <attribute name="Plugin-Version" value="${version.entry.commit.revision}"/>
    3030            </manifest>
  • applications/editors/josm/plugins/slippymap/src/org/openstreetmap/josm/plugins/slippymap/SlippyMapLayer.java

    r18590 r18593  
    55import java.awt.Color;
    66import java.awt.Component;
    7 import java.awt.Dimension;
    87import java.awt.Graphics;
     8import java.awt.Graphics2D;
    99import java.awt.Image;
    1010import java.awt.Point;
     
    1616import java.awt.image.ImageObserver;
    1717import java.util.ArrayList;
    18 import java.util.Comparator;
    19 import java.util.Enumeration;
    20 import java.util.Hashtable;
     18import java.util.HashSet;
     19import java.util.LinkedList;
    2120import java.util.List;
    22 import java.util.LinkedList;
    23 import java.util.HashSet;
    2421
    2522import javax.swing.AbstractAction;
    2623import javax.swing.Icon;
     24import javax.swing.JCheckBoxMenuItem;
    2725import javax.swing.JMenuItem;
    28 import javax.swing.JCheckBoxMenuItem;
    2926import javax.swing.JPopupMenu;
    3027import javax.swing.JSeparator;
    3128import javax.swing.SwingUtilities;
    3229
     30import org.openstreetmap.gui.jmapviewer.JobDispatcher;
     31import org.openstreetmap.gui.jmapviewer.MemoryTileCache;
     32import org.openstreetmap.gui.jmapviewer.OsmFileCacheTileLoader;
     33import org.openstreetmap.gui.jmapviewer.Tile;
     34import org.openstreetmap.gui.jmapviewer.interfaces.TileCache;
     35import org.openstreetmap.gui.jmapviewer.interfaces.TileLoader;
     36import org.openstreetmap.gui.jmapviewer.interfaces.TileLoaderListener;
     37import org.openstreetmap.gui.jmapviewer.interfaces.TileSource;
    3338import org.openstreetmap.josm.Main;
    3439import org.openstreetmap.josm.actions.RenameLayerAction;
     40import org.openstreetmap.josm.data.Bounds;
    3541import org.openstreetmap.josm.data.Preferences.PreferenceChangedListener;
    3642import org.openstreetmap.josm.data.coor.LatLon;
     
    4147import org.openstreetmap.josm.gui.layer.Layer;
    4248import org.openstreetmap.josm.tools.ImageProvider;
    43 
    44 import org.openstreetmap.gui.jmapviewer.*;
    45 import org.openstreetmap.gui.jmapviewer.interfaces.*;
    46 import org.openstreetmap.gui.jmapviewer.Tile;
    4749
    4850/**
     
    501503        //int otherZooms[] = {-5, -4, -3, 2, -2, 1, -1};
    502504        int otherZooms[] = { -1, 1, -2, 2, -3, -4, -5};
    503         int painted = 0;;
     505        int painted = 0;
    504506        debug = true;
    505507        for (int zoomOff : otherZooms) {
     
    604606    // The "border" tile tells us the boundaries of where we may
    605607    // draw.  It will not be from the zoom level that is being
    606     // drawn currently.  If drawing the currentZoomLevel, 
     608    // drawn currently.  If drawing the currentZoomLevel,
    607609    // border is null and we draw the entire tile set.
    608610    List<Tile> paintTileImages(Graphics g, TileSet ts, int zoom, Tile border) {
     
    616618            if (img == null) {
    617619                if (debug)
    618                     out("missed tile: " + tile); 
     620                    out("missed tile: " + tile);
    619621                missedTiles.add(tile);
    620622                continue;
     
    808810     */
    809811    @Override
    810     public void paint(Graphics g, MapView mv) {
    811         long start = System.currentTimeMillis();
     812    public void paint(Graphics2D g, MapView mv, Bounds bounds) {
     813        //long start = System.currentTimeMillis();
    812814        LatLon topLeft = mv.getLatLon(0, 0);
    813815        LatLon botRight = mv.getLatLon(mv.getWidth(), mv.getHeight());
    814         Graphics oldg = g;
     816        Graphics2D oldg = g;
    815817
    816818        if (botRight.lon() == 0.0 || botRight.lat() == 0) {
     
    834836        lastBotRight = botRight;
    835837        bufferImage = mv.createImage(mv.getWidth(), mv.getHeight());
    836         g = bufferImage.getGraphics();
     838        g = (Graphics2D) bufferImage.getGraphics();
    837839
    838840        int zoom = currentZoomLevel;
     
    844846                    out("too many tiles, decreasing zoom from " + currentZoomLevel);
    845847                if (decreaseZoomLevel())
    846                     this.paint(oldg, mv);
     848                    this.paint(oldg, mv, bounds);
    847849                return;
    848850            }
     
    852854                        + "), increasing zoom from " + currentZoomLevel);
    853855                if (increaseZoomLevel())
    854                      this.paint(oldg, mv);
     856                     this.paint(oldg, mv, bounds);
    855857                return;
    856858            }
     
    899901            this.paintTileText(ts, t, g, mv, currentZoomLevel, t);
    900902        }
    901         float fadeBackground = SlippyMapPreferences.getFadeBackground();
    902903        oldg.drawImage(bufferImage, 0, 0, null);
    903904
     
    909910                    out("autozoom increase: scale: " + lastImageScale);
    910911                increaseZoomLevel();
    911                 this.paint(oldg, mv);
     912                this.paint(oldg, mv, bounds);
    912913            // If each source image pixel is being squished into > 0.32
    913914            // of a drawn pixels, zoom out.
     
    916917                    out("autozoom decrease: scale: " + lastImageScale);
    917918                decreaseZoomLevel();
    918                 this.paint(oldg, mv);
     919                this.paint(oldg, mv, bounds);
    919920            }
    920921        }
  • applications/editors/josm/plugins/validator/build.xml

    r18524 r18593  
    2727        -->
    2828        <property name="commit.message" value="Updated build.xml" />           
    29         <property name="plugin.main.version" value="2414" />
     29        <property name="plugin.main.version" value="2450" />
    3030               
    3131               
  • applications/editors/josm/plugins/validator/src/org/openstreetmap/josm/plugins/validator/ErrorLayer.java

    r17175 r18593  
    44
    55import java.awt.Component;
    6 import java.awt.Graphics;
     6import java.awt.Graphics2D;
    77import java.util.Enumeration;
    88import java.util.List;
     
    1515import org.openstreetmap.josm.Main;
    1616import org.openstreetmap.josm.actions.RenameLayerAction;
     17import org.openstreetmap.josm.data.Bounds;
    1718import org.openstreetmap.josm.data.osm.visitor.BoundingXYVisitor;
    1819import org.openstreetmap.josm.gui.MapView;
     
    2728/**
    2829 * A layer showing error messages.
    29  * 
     30 *
    3031 * @author frsantos
    3132 */
     
    5455    @SuppressWarnings("unchecked")
    5556    @Override
    56     public void paint(final Graphics g, final MapView mv) {
     57    public void paint(final Graphics2D g, final MapView mv, Bounds bounds) {
    5758        DefaultMutableTreeNode root = plugin.validationDialog.tree.getRoot();
    5859        if (root == null || root.getChildCount() == 0)
     
    114115    public Component[] getMenuEntries() {
    115116        return new Component[] { new JMenuItem(LayerListDialog.getInstance().createShowHideLayerAction(this)),
    116                 new JMenuItem(LayerListDialog.getInstance().createDeleteLayerAction(this)), 
     117                new JMenuItem(LayerListDialog.getInstance().createDeleteLayerAction(this)),
    117118                new JSeparator(),
    118119                new JMenuItem(new RenameLayerAction(null, this)), new JSeparator(),
  • applications/editors/josm/plugins/validator/src/org/openstreetmap/josm/plugins/validator/GridLayer.java

    r17351 r18593  
    44import java.awt.Component;
    55import java.awt.Graphics;
     6import java.awt.Graphics2D;
    67import java.awt.Point;
    78import java.awt.geom.Point2D;
     
    1314import org.openstreetmap.josm.Main;
    1415import org.openstreetmap.josm.actions.RenameLayerAction;
     16import org.openstreetmap.josm.data.Bounds;
    1517import org.openstreetmap.josm.data.coor.EastNorth;
    1618import org.openstreetmap.josm.data.osm.Node;
     
    5456     */
    5557    @Override
    56     public void paint(final Graphics g, final MapView mv)
     58    public void paint(final Graphics2D g, final MapView mv, Bounds bounds)
    5759    {
    5860        if( !Main.pref.hasKey(PreferenceEditor.PREF_DEBUG + ".grid") )
  • applications/editors/josm/plugins/validator/src/org/openstreetmap/josm/plugins/validator/Test.java

    r18514 r18593  
    11package org.openstreetmap.josm.plugins.validator;
     2
     3import static org.openstreetmap.josm.tools.I18n.tr;
    24
    35import java.util.ArrayList;
     
    810import javax.swing.JPanel;
    911
    10 import org.openstreetmap.josm.Main;
    1112import org.openstreetmap.josm.command.Command;
    1213import org.openstreetmap.josm.data.osm.BackreferencedDataSet;
     
    1920import org.openstreetmap.josm.gui.progress.ProgressMonitor;
    2021import org.openstreetmap.josm.tools.GBC;
    21 import static org.openstreetmap.josm.tools.I18n.tr;
    2222
    2323/**
     
    9595
    9696    /**
    97      * Start the test using a given progress monitor 
    98      * 
    99      * @param progressMonitor  the progress monitor 
     97     * Start the test using a given progress monitor
     98     *
     99     * @param progressMonitor  the progress monitor
    100100     */
    101101    public void startTest(ProgressMonitor progressMonitor) {
  • applications/editors/josm/plugins/validator/src/org/openstreetmap/josm/plugins/validator/tests/DuplicateNode.java

    r18514 r18593  
    55import java.awt.geom.Area;
    66import java.util.Collection;
     7import java.util.LinkedHashSet;
    78import java.util.LinkedList;
    8 import java.util.LinkedHashSet;
    99import java.util.List;
    1010import java.util.Map;
  • applications/editors/josm/plugins/validator/src/org/openstreetmap/josm/plugins/validator/tests/UnconnectedWays.java

    r18425 r18593  
    1919import org.openstreetmap.josm.data.coor.EastNorth;
    2020import org.openstreetmap.josm.data.coor.LatLon;
     21import org.openstreetmap.josm.data.osm.BBox;
    2122import org.openstreetmap.josm.data.osm.DataSet;
    2223import org.openstreetmap.josm.data.osm.Node;
     
    2425import org.openstreetmap.josm.data.osm.QuadBuckets;
    2526import org.openstreetmap.josm.data.osm.Way;
    26 import org.openstreetmap.josm.data.osm.QuadBuckets.BBox;
    2727import org.openstreetmap.josm.gui.progress.ProgressMonitor;
    2828import org.openstreetmap.josm.plugins.validator.PreferenceEditor;
     
    7575        this.ds = Main.main.getCurrentDataSet();
    7676        this.ds_area = ds.getDataSourceArea();
    77         this.ds.reindexAll();
    78         }
     77    }
    7978
    8079    @Override
     
    196195    private class MyWaySegment
    197196    {
    198         private Line2D line;
    199         public Way w;
    200         public boolean isAbandoned = false;
    201         public boolean isBoundary = false;
    202         public boolean highway;
    203         private double len;
     197        private final Line2D line;
     198        public final Way w;
     199        public final boolean isAbandoned;
     200        public final boolean isBoundary;
     201        public final boolean highway;
     202        private final double len;
    204203        private Set<Node> nearbyNodeCache;
    205204        double nearbyNodeCacheDist = -1.0;
    206         Node n1;
    207         Node n2;
     205        final Node n1;
     206        final Node n2;
    208207
    209208        public MyWaySegment(Way w, Node n1, Node n2)
     
    368367    private void addNode(Node n, Set<Node> s)
    369368    {
    370         Boolean m = middlenodes.contains(n);
    371         Boolean e = endnodes.contains(n);
    372         Boolean eh = endnodes_highway.contains(n);
    373         Boolean o = othernodes.contains(n);
     369        boolean m = middlenodes.contains(n);
     370        boolean e = endnodes.contains(n);
     371        boolean eh = endnodes_highway.contains(n);
     372        boolean o = othernodes.contains(n);
    374373        if(!m && !e && !o && !eh)
    375374            s.add(n);
Note: See TracChangeset for help on using the changeset viewer.