Changeset 16290 in osm


Ignore:
Timestamp:
2009-07-03T12:34:14+02:00 (15 years ago)
Author:
stoecker
Message:

adapted plugins to JOSm 1722, UtilsPlugin still has a problem

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

Legend:

Unmodified
Added
Removed
  • applications/editors/josm/plugins/Create_grid_of_ways/build.xml

    r14370 r16290  
    2626                <attribute name="Plugin-Description" value="Create a grid of ways."/>
    2727                <attribute name="Plugin-Link" value="http://wiki.openstreetmap.org/wiki/Create_grid_of_ways"/>
    28                 <attribute name="Plugin-Mainversion" value="1208"/>
     28                <attribute name="Plugin-Mainversion" value="1722"/>
    2929                <attribute name="Plugin-Version" value="${version.entry.commit.revision}"/>
    3030            </manifest>
  • applications/editors/josm/plugins/Create_grid_of_ways/src/CreateGridOfWaysPlugin/CreateGridOfWaysAction.java

    r14370 r16290  
    7575        double latDif,lonDif;
    7676        for (Node n1 : nodesWay1) {
    77             latDif = n1.coor.lat()-nodeCommon.coor.lat();
    78             lonDif = n1.coor.lon()-nodeCommon.coor.lon();
     77            latDif = n1.getCoor().lat()-nodeCommon.getCoor().lat();
     78            lonDif = n1.getCoor().lon()-nodeCommon.getCoor().lon();
    7979            c2=0;
    8080            for (Node n2 : nodesWay2) {
     
    8989                    continue;
    9090                }
    91                 Node nodeOfGrid = new Node(new LatLon(n2.coor.lat()+latDif,n2.coor.lon()+lonDif));
     91                Node nodeOfGrid = new Node(new LatLon(n2.getCoor().lat()+latDif,n2.getCoor().lon()+lonDif));
    9292                cmds.add(new AddCommand(nodeOfGrid));
    9393                w1[c1].nodes.add(nodeOfGrid);
  • applications/editors/josm/plugins/agpifoj/build.xml

    r14018 r16290  
    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="1465"/>
     36                <attribute name="Plugin-Mainversion" value="1722"/>
    3737                <attribute name="Plugin-Version" value="${version.entry.commit.revision}"/>
    3838            </manifest>
  • applications/editors/josm/plugins/agpifoj/src/org/openstreetmap/josm/plugins/agpifoj/AgpifojDialog.java

    r14916 r16290  
    124124            centerView = ((JToggleButton) e.getSource()).isSelected();
    125125            if (centerView && currentEntry != null && currentEntry.pos != null) {
    126                 Main.map.mapView.zoomTo(currentEntry.pos, Main.map.mapView.getScale());
     126                Main.map.mapView.zoomTo(currentEntry.pos);
    127127            }
    128128
     
    153153
    154154            if (centerView && Main.map != null && entry != null && entry.pos != null) {
    155                 Main.map.mapView.zoomTo(entry.pos, Main.map.mapView.getScale());
     155                Main.map.mapView.zoomTo(entry.pos);
    156156            }
    157157
  • applications/editors/josm/plugins/agpifoj/src/org/openstreetmap/josm/plugins/agpifoj/CorrelateGpxWithImages.java

    r15960 r16290  
    623623                BoundingXYVisitor bbox = new BoundingXYVisitor();
    624624                l.visitBoundingBox(bbox);
    625                 if (bbox.min != null && bbox.max != null) {
     625                if (bbox.getBounds() != null) {
    626626                    boundingBoxedLayerFound = true;
    627627                    break;
  • applications/editors/josm/plugins/czechaddress/build.xml

    r15829 r16290  
    5151            <attribute name="Plugin-Description" value="Creating and handling address nodes and buildings within Czech Republic."/>
    5252            <attribute name="Plugin-Link" value="http://wiki.openstreetmap.org/index.php/Cz:JOSM/Plugins/CzechAddress"/>
    53             <attribute name="Plugin-Mainversion" value="1607"/>
     53            <attribute name="Plugin-Mainversion" value="1722"/>
    5454            <!--<attribute name="Plugin-Version" value="${version.entry.commit.revision}"/>-->
    5555            <attribute name="Plugin-Version" value="${version.entry.commit.revision}"/>
  • applications/editors/josm/plugins/czechaddress/src/org/openstreetmap/josm/plugins/czechaddress/MapUtils.java

    r15585 r16290  
    33import java.util.Collection;
    44import org.openstreetmap.josm.Main;
    5 import org.openstreetmap.josm.data.osm.Node;
     5import org.openstreetmap.josm.actions.AutoScaleAction;
    66import org.openstreetmap.josm.data.osm.OsmPrimitive;
    7 import org.openstreetmap.josm.data.osm.Way;
    8 import org.openstreetmap.josm.data.osm.visitor.BoundingXYVisitor;
    9 import org.openstreetmap.josm.gui.MapView;
    107
    118/**
     
    2118
    2219    /**
    23      * Zoom level used for zooming to a single node.
    24      */
    25     public static final double NODE_ZOOM_LEVEL = 0.00000007;
    26 
    27 
    28     /**
    2920     * Selects and zooms the JOSM viewport to given primitives.
    30      *
    31      * <p>It does so by calculating the center of given primitives and
    32      * then it zooms to it.</p>
    33      *
    34      * <p><b>WARNING and TODO:</b> The method {@code zoomTo()} currently
    35      * checks for damaged {@link Node}s, whose {@code eastNorth} is set to
    36      * null. This property is not accessed in this method and therefore
    37      * no checking is done. However the "mad GUI" problem may still arise.
    38      * Therefore please be careful.</p>
    39      *
    40      * @see BoundingXYVisitor
    41      * @see MapView
    4221     */
    4322    public static void zoomToMany(Collection<OsmPrimitive> primitives) {
    44         BoundingXYVisitor visitor = new BoundingXYVisitor();
    45         for (OsmPrimitive op : primitives) {
    46             if (op instanceof Node)
    47                 ((Node) op).visit(visitor);
    48 
    49             else if (op instanceof Way)
    50                 ((Way) op).visit(visitor);
    51         }
    52         Main.map.mapView.zoomTo(
    53                 visitor.min.interpolate(visitor.max, 0.5),
    54                 NODE_ZOOM_LEVEL);
    5523        Main.ds.setSelected(primitives);
     24        (new AutoScaleAction("selection")).actionPerformed(null);
    5625    }
    5726
    5827    /**
    5928     * Selects and zooms the JOSM viewport to given primitive.
    60      *
    61      * <p><b>TODO:</b> There is an error in JOSM, which makes the whole
    62      * GUI totally mad if we zoom to a {@link Node}, whose {@code eastNorth}
    63      * is set null. Currently zooming to such a node is ignored, but the
    64      * question is where so such damaged nodes come from?</p>
    65      *
    66      * @see BoundingXYVisitor
    67      * @see MapView
    6829     */
    6930    public static void zoomTo(OsmPrimitive primitive) {
    70         BoundingXYVisitor visitor = new BoundingXYVisitor();
    71 
    72         if (primitive instanceof Node && ((Node) primitive).eastNorth != null)
    73             Main.map.mapView.zoomTo(((Node) primitive).eastNorth, NODE_ZOOM_LEVEL);
    74 
    75         else if (primitive instanceof Way) {
    76             ((Way) primitive).visit(visitor);
    77             Main.map.mapView.zoomTo(
    78                     visitor.min.interpolate(visitor.max, 0.5),
    79                     NODE_ZOOM_LEVEL);
    80         }
    81 
    8231        Main.ds.setSelected(primitive);
     32        (new AutoScaleAction("selection")).actionPerformed(null);
    8333    }
    8434}
  • applications/editors/josm/plugins/czechaddress/src/org/openstreetmap/josm/plugins/czechaddress/addressdatabase/AddressElement.java

    r15585 r16290  
    9797
    9898        if (prim instanceof Node)
    99             result += " " + StringUtils.latLonToString(((Node) prim).coor);
     99            result += " " + StringUtils.latLonToString(((Node) prim).getCoor());
    100100        else if (prim instanceof Way)
    101             result += " " + StringUtils.latLonToString(((Way) prim).firstNode().coor);
     101            result += " " + StringUtils.latLonToString(((Way) prim).firstNode().getCoor());
    102102
    103103        return result;
  • applications/editors/josm/plugins/czechaddress/src/org/openstreetmap/josm/plugins/czechaddress/gui/LocationSelector.java

    r15649 r16290  
    4040        LocationSelector ls = new LocationSelector();
    4141        ls.setVisible(true);
    42        
     42
    4343        if (ls.getValue() == 1)
    4444            return ls.selectedElement;
     
    5050        super(Main.parent, "Výběr umístění",
    5151                            new String[] { "OK", "Zrušit"}, true);
    52        
     52
    5353        initComponents();
    5454        setupDialog(mainPanel, new String[] { "ok.png", "cancel.png"});
     
    6868     * Hardly ever working method for autodetecting the current location.
    6969     *
    70      * @deprecated 
     70     * @deprecated
    7171     */
    7272    private void autodetectLocation() {
     
    9393
    9494        try {
    95             Bounds bounds = visitor.getBounds();
    96             LatLon max = bounds.max;
    97             LatLon min = bounds.min;
    98             center = new LatLon(
    99                     (max.getX() + min.getX()) / 2,
    100                     (max.getY() + min.getY()) / 2);
    101 
     95            center = Main.proj.eastNorth2latlon(visitor.getBounds().getCenter());
    10296        } catch (Exception e) {
    10397            System.err.println("AUTO: No bounds to determine autolocation.");
     
    128122            }
    129123
    130             double currLen = multiplicator * (node.coor.distance(center));
     124            double currLen = multiplicator * (node.getCoor().distance(center));
    131125
    132126
     
    138132
    139133        if (bestFit != null) {
    140            
     134
    141135            if (assertions)
    142136                System.out.println("AUTO: Best fit " + bestFit.getName()
    143137                                 + "\t " + bestFit.get("name"));
    144            
     138
    145139            for (Region oblast : Database.getInstance().regions) {
    146140                for (ViToCi obec : oblast.getViToCis()) {
     
    263257        ItemEvent event = new ItemEvent(this,
    264258                   ItemEvent.DESELECTED, selectedElement, ItemEvent.DESELECTED);
    265        
     259
    266260        for (ItemListener i : listeners)
    267261            i.itemStateChanged(event);
     
    271265        event = new ItemEvent(this,
    272266                       ItemEvent.SELECTED, selectedElement, ItemEvent.SELECTED);
    273        
     267
    274268        for (ItemListener i : listeners)
    275269                i.itemStateChanged(event);
     
    323317        else if (oblastComboBox.getSelectedItem() != null)
    324318            selectedElement = ((ElementWithStreets) oblastComboBox.getSelectedItem());
    325        
     319
    326320        }//GEN-LAST:event_suburbComboBoxItemStateChanged
    327321
  • applications/editors/josm/plugins/czechaddress/src/org/openstreetmap/josm/plugins/czechaddress/proposal/ExtractAddressIntoNodeProposal.java

    r15166 r16290  
    5151        if (!isApplicable(primitive))
    5252            return;
    53        
     53
    5454        Way way = (Way) primitive;
    5555
    5656        BoundingXYVisitor visitor = new BoundingXYVisitor();
    5757        way.visit(visitor);
    58         LatLon center = new LatLon(
    59                 (visitor.getBounds().max.lat() + visitor.getBounds().min.lat())/2,
    60                 (visitor.getBounds().max.lon() + visitor.getBounds().min.lon())/2
    61             );
    62        
    63         Node addrNode = new Node(center);
     58
     59        Node addrNode = new Node(visitor.getBounds().getCenter());
    6460
    6561        for (String key : way.keySet())
     
    7571    /**
    7672     * Returns textual representation of this proposal.
    77      * 
     73     *
    7874     * Currently the string is in Czech language (see {@link CzechAddressPlugin}).
    7975     */
     
    8379    }
    8480
    85    
     81
    8682
    8783}
  • applications/editors/josm/plugins/editgpx/build.xml

    r15678 r16290  
    2626                <attribute name="Plugin-Description" value="Allows the user to anonymize timestamps and delete parts of huge GPX tracks very fast." />
    2727                <attribute name="Plugin-Link" value="http://wiki.openstreetmap.org/wiki/JOSM/Plugins/EditGpx" />
    28                 <attribute name="Plugin-Mainversion" value="1500" />
     28                <attribute name="Plugin-Mainversion" value="1722" />
    2929                <attribute name="Plugin-Version" value="${version.entry.commit.revision}"/>
    3030            </manifest>
  • applications/editors/josm/plugins/editgpx/src/org/openstreetmap/josm/plugins/editgpx/EditGpxLayer.java

    r15186 r16290  
    113113            for(Node n: dataSet.nodes) {
    114114                if (!n.deleted) {
    115                     LatLon c = n.coor;
    116                     Point pnt = Main.map.mapView.getPoint(Main.proj.latlon2eastNorth(c));
     115                    Point pnt = Main.map.mapView.getPoint(n.getEastNorth());
    117116                    g.drawOval(pnt.x - 2, pnt.y - 2, 4, 4);
    118117                }
     
    166165                doneNodes.add(n);
    167166
    168                 WayPoint wpt = new WayPoint(n.coor);
     167                WayPoint wpt = new WayPoint(n.getCoor());
    169168                if (anonTime) {
    170169                    wpt.attr.put("time", "1970-01-01T00:00:00");
     
    184183            Date tstamp = n.getTimestamp();
    185184
    186             WayPoint wpt = new WayPoint(n.coor);
     185            WayPoint wpt = new WayPoint(n.getCoor());
    187186            if (anonTime) {
    188187                wpt.attr.put("time", "1970-01-01T00:00:00");
  • applications/editors/josm/plugins/editgpx/src/org/openstreetmap/josm/plugins/editgpx/EditGpxMode.java

    r14245 r16290  
    6464            Point pointReleased = e.getPoint();
    6565
    66             //prepare vars
    67             EastNorth en;
    68             double scale = Main.map.mapView.getScale();
    69             EastNorth center = Main.map.mapView.getCenter(); //Center n/e coordinate of the desired screen center.
    70             int width = Main.map.mapView.getWidth();
    71             int height = Main.map.mapView.getHeight();
    7266            Rectangle r = createRect(pointReleased, pointPressed);
    7367
    7468            //go through nodes and mark the ones in the selection rect as deleted
    7569            for (Node n: dataSet.nodes) {
    76                 en = n.eastNorth;
    77                 //calculate point on screen from node n
    78                 double x = (en.east()-center.east())/scale + width/2;
    79                 double y = (center.north()-en.north())/scale + height/2;
    80                 Point p = new Point((int)x,(int)y);
     70                Point p = Main.map.mapView.getPoint(n.getEastNorth());
    8171                if (r.contains(p)) {
    8272                    n.deleted = true; //only set as deleted. this makes reset to beginning possible
  • applications/editors/josm/plugins/livegps/build.xml

    r14120 r16290  
    2626                <attribute name="Plugin-Description" value="Support live GPS input (moving dot) through a connection to gpsd server."/>
    2727                <attribute name="Plugin-Link" value="http://wiki.openstreetmap.org/index.php/JOSM/Plugins/LiveGPS"/>
    28                 <attribute name="Plugin-Mainversion" value="1498"/>
     28                <attribute name="Plugin-Mainversion" value="1722"/>
    2929                <attribute name="Plugin-Stage" value="50"/>
    3030                <attribute name="Plugin-Version" value="${version.entry.commit.revision}"/>
  • applications/editors/josm/plugins/livegps/src/livegps/LiveGpsLayer.java

    r14057 r16290  
    7474    {
    7575        if (lastPoint != null)
    76             Main.map.mapView.zoomTo(lastPoint.eastNorth, Main.map.mapView.getScale());
     76            Main.map.mapView.zoomTo(lastPoint.eastNorth);
    7777    }
    7878
  • applications/editors/josm/plugins/openstreetbugs/build.xml

    r16163 r16290  
    2626                <attribute name="Plugin-Description" value="Imports issues from OpenStreetBugs"/>
    2727                <attribute name="Plugin-Link" value="http://wiki.openstreetmap.org/index.php/JOSM/Plugins/OpenStreetBugs"/>
    28                 <attribute name="Plugin-Mainversion" value="1638"/>
     28                <attribute name="Plugin-Mainversion" value="1722"/>
    2929                <attribute name="Plugin-Version" value="${version.entry.commit.revision}"/>
    3030            </manifest>
  • applications/editors/josm/plugins/openstreetbugs/src/org/openstreetmap/josm/plugins/osb/api/DownloadAction.java

    r16134 r16290  
    3737import org.openstreetmap.josm.data.osm.DataSet;
    3838import org.openstreetmap.josm.data.osm.Node;
     39import org.openstreetmap.josm.tools.OsmUrlToBounds;
    3940import org.openstreetmap.josm.plugins.osb.ConfigKeys;
    4041import org.openstreetmap.josm.plugins.osb.api.util.HttpUtils;
     
    4849        String uri = Main.pref.get(ConfigKeys.OSB_API_URI_DOWNLOAD);
    4950
     51        int zoom = OsmUrlToBounds.getZoom(Main.map.mapView.getRealBounds());
    5052        // check zoom level
    51         if(Main.map.mapView.zoom() > 15 || Main.map.mapView.zoom() < 9) {
     53        if(zoom > 15 || zoom < 9) {
    5254            return;
    5355        }
  • applications/editors/josm/plugins/openstreetbugs/src/org/openstreetmap/josm/plugins/osb/gui/OsbDialog.java

    r16163 r16290  
    7575import org.openstreetmap.josm.plugins.osb.gui.action.OsbActionObserver;
    7676import org.openstreetmap.josm.plugins.osb.gui.action.PopupFactory;
     77import org.openstreetmap.josm.tools.OsmUrlToBounds;
    7778import org.openstreetmap.josm.tools.Shortcut;
    7879
     
    118119
    119120            public void actionPerformed(ActionEvent e) {
     121                int zoom = OsmUrlToBounds.getZoom(Main.map.mapView.getRealBounds());
    120122                // check zoom level
    121                 if (Main.map.mapView.zoom() > 15 || Main.map.mapView.zoom() < 9) {
     123                if (zoom > 15 || zoom < 9) {
    122124                    JOptionPane.showMessageDialog(Main.parent,
    123125                            tr("The visible area is either too small or too big to download data from OpenStreetBugs"),
     
    257259
    258260    public void zoomToNode(Node node) {
    259         double scale = Main.map.mapView.getScale();
    260         Main.map.mapView.zoomTo(node.getEastNorth(), scale);
     261        Main.map.mapView.zoomTo(node.getEastNorth());
    261262    }
    262263
  • applications/editors/josm/plugins/piclayer/build.xml

    r16177 r16290  
    8181                <attribute name="Plugin-Date" value="${version.entry.commit.date}"/>
    8282                <attribute name="Plugin-Description" value="This plugin allows to display any picture as a background in the editor and align it with the map."/>
    83                 <attribute name="Plugin-Mainversion" value="1529"/>
     83                <attribute name="Plugin-Mainversion" value="1722"/>
    8484                <attribute name="Plugin-Version" value="${version.entry.commit.revision}"/>
    8585            </manifest>
  • applications/editors/josm/plugins/piclayer/src/org/openstreetmap/josm/plugins/piclayer/PicLayerAbstract.java

    r14779 r16290  
    4747 * anything...)
    4848 */
    49 public abstract class PicLayerAbstract extends Layer 
     49public abstract class PicLayerAbstract extends Layer
    5050{
    51         // Counter - just for naming of layers
    52         private static int m_counter = 0;
    53         // This is the main image to be displayed
    54         private BufferedImage m_image = null;
    55         // Initial position of the image in the real world
    56         private EastNorth m_initial_position;
    57         // Position of the image in the real world
    58         private EastNorth m_position;
    59         // Angle of rotation of the image
    60         private double m_angle = 0.0;
    61         // Scale of the image
    62         private double m_scale = 1.0;
    63         // The scale that was set on the map during image creation
    64         private double m_initial_scale = 0;
    65         // Popup menu items
    66         private Component m_popupmenu[] = null;
    67         // Layer icon
     51    // Counter - just for naming of layers
     52    private static int m_counter = 0;
     53    // This is the main image to be displayed
     54    private BufferedImage m_image = null;
     55    // Initial position of the image in the real world
     56    private EastNorth m_initial_position;
     57    // Position of the image in the real world
     58    private EastNorth m_position;
     59    // Angle of rotation of the image
     60    private double m_angle = 0.0;
     61    // Scale of the image
     62    private double m_scale = 1.0;
     63    // The scale that was set on the map during image creation
     64    private double m_initial_scale = 0;
     65    // Popup menu items
     66    private Component m_popupmenu[] = null;
     67    // Layer icon
    6868    private Icon m_layericon = null;
    69        
    70         /**
    71         * Constructor
    72         */
     69
     70    /**
     71    * Constructor
     72    */
    7373    public PicLayerAbstract() {
    7474        super("PicLayer #" + m_counter);
     
    7676        //Increase number
    7777        m_counter++;
    78        
     78
    7979        // Create popup menu
    8080        // Reset submenu
     
    8787        // Main menu
    8888        m_popupmenu = new Component[]{
    89                         reset_submenu,
    90                         new JSeparator(),
    91                         new JMenuItem( new HelpAction() )
     89                reset_submenu,
     90                new JSeparator(),
     91                new JMenuItem( new HelpAction() )
    9292        };
    93        
     93
    9494        // Load layer icon
    9595        m_layericon = new ImageIcon(Toolkit.getDefaultToolkit().createImage(PicLayerAbstract.class.getResource("/images/layericon.png")));
    96     }           
    97    
     96    }
     97
    9898    /**
    9999     * Initializes the image. Gets the image from a subclass and stores some
     
    101101     */
    102102    public void Initialize() throws IOException {
    103        
    104         // Create image
    105         Image image = createImage();
    106         if ( image == null ) {
    107                 throw new IOException( "Image not created properly.");
    108         }
    109         // Convert to Buffered Image - not sure if this is the right way...
    110         m_image = new BufferedImage( image.getWidth(null), image.getHeight(null), BufferedImage.TYPE_INT_ARGB );
    111         Graphics g = m_image.getGraphics();
    112         g.drawImage( image, 0, 0, null );
    113        
    114         // If the map does not exist - we're screwed. We should not get into this situation in the first place!
    115         if ( Main.map != null && Main.map.mapView != null ) {
    116                 // Geographical position of the image
    117                 m_initial_position = m_position = Main.map.mapView.getCenter();
    118                 // Initial scale at which the image was loaded
    119                 m_initial_scale = Main.map.mapView.getScale();
    120         } else {
    121                 throw new IOException( "Could not find the map object." );
    122         }
    123     }
    124    
     103
     104        // Create image
     105        Image image = createImage();
     106        if ( image == null ) {
     107            throw new IOException( "Image not created properly.");
     108        }
     109        // Convert to Buffered Image - not sure if this is the right way...
     110        m_image = new BufferedImage( image.getWidth(null), image.getHeight(null), BufferedImage.TYPE_INT_ARGB );
     111        Graphics g = m_image.getGraphics();
     112        g.drawImage( image, 0, 0, null );
     113
     114        // If the map does not exist - we're screwed. We should not get into this situation in the first place!
     115        if ( Main.map != null && Main.map.mapView != null ) {
     116            // Geographical position of the image
     117            m_initial_position = m_position = Main.map.mapView.getCenter();
     118            // Initial scale at which the image was loaded
     119            m_initial_scale = Main.map.mapView.getMapScale();
     120        } else {
     121            throw new IOException( "Could not find the map object." );
     122        }
     123    }
     124
    125125    /**
    126126     * To be overridden by subclasses. Provides an image from an external sources.
    127127     * Throws exception if something does not work.
    128      * 
     128     *
    129129     * TODO: Replace the IOException by our own exception.
    130130     */
    131131    protected abstract Image createImage() throws IOException;
    132    
     132
    133133    /**
    134134     * To be overridden by subclasses. Returns the user readable name of the layer.
    135135     */
    136136    protected abstract String getPicLayerName();
    137        
    138         @Override
    139         public Icon getIcon() {
    140                 return m_layericon;
    141         }
    142 
    143         @Override
    144         public Object getInfoComponent() {
    145                 // TODO Auto-generated method stub
    146                 return null;
    147         }
    148 
    149         @Override
    150         public Component[] getMenuEntries() {
    151                 return m_popupmenu;
    152         }
    153 
    154         @Override
    155         public String getToolTipText() {
    156                 return getPicLayerName();
    157         }
    158 
    159         @Override
    160         public boolean isMergable(Layer arg0) {
    161                 // TODO Auto-generated method stub
    162                 return false;
    163         }
    164 
    165         @Override
    166         public void mergeFrom(Layer arg0) {
    167                 // TODO Auto-generated method stub
    168 
    169         }
    170 
    171         @Override
    172         public void paint(Graphics arg0, MapView arg1) {
    173                
    174                 if ( m_image != null && arg0 instanceof Graphics2D) {
    175                        
    176                         // Position image at the right graphical place
    177                         EastNorth center = Main.map.mapView.getCenter();
    178                         EastNorth leftop = Main.map.mapView.getEastNorth( 0, 0 );
    179                         double pixel_per_en = ( Main.map.mapView.getWidth() / 2.0 ) / ( center.east() - leftop.east() );
    180 
    181                         //      This is now the offset in screen pixels
    182                         double pic_offset_x = (( m_position.east() - leftop.east() ) * pixel_per_en);
    183                         double pic_offset_y = (( leftop.north() - m_position.north() ) * pixel_per_en);
    184                
    185                         // Let's use Graphics 2D
    186                         Graphics2D g = (Graphics2D)arg0.create();
    187                         // Move
    188                         g.translate( pic_offset_x, pic_offset_y );
    189                         // Rotate
    190                         g.rotate( m_angle * Math.PI / 180.0 );
    191                         // Scale
    192                     double scale = m_scale * m_initial_scale / Main.map.mapView.getScale();
    193                     g.scale( scale, scale );
    194                    
    195                     // Draw picture
    196                         g.drawImage( m_image, -m_image.getWidth() / 2, -m_image.getHeight() / 2, null );
    197                        
    198                         // Draw additional rectangle for the active pic layer
    199                         if ( Main.map.mapView.getActiveLayer() == this ) {
    200                                 g.setColor( new Color( 0xFF0000 ) );
    201                                 g.drawRect(
    202                                         -m_image.getWidth() / 2,
    203                                         -m_image.getHeight() / 2,
    204                                         m_image.getWidth(),
    205                                         m_image.getHeight()
    206                                 );
    207                         }
    208                 } else {
    209                         // TODO: proper logging
    210                         System.out.println( "PicLayerAbstract::paint - general drawing error (m_image is null or Graphics not 2D" );
    211                 }
    212         }
    213        
    214         /**
    215         * Moves the picture. Scaled in EastNorth...
    216         */
    217         public void movePictureBy( double east, double north ) {
    218                 m_position = m_position.add( east, north );
    219         }
    220 
    221         /**
    222         * Scales the picture. Scaled in... don't know but works ok :)
    223         */
    224         public void scalePictureBy( double scale ) {
    225                 m_scale += scale;
    226         }       
    227 
    228         /**
    229         * Rotates the picture. Scales in angles.
    230         */
    231         public void rotatePictureBy( double angle ) {
    232                 m_angle += angle;
    233         }       
    234        
    235         /**
    236         * Sets the image position to the initial position
    237         */
    238         public void resetPosition() {
    239                 m_position = m_initial_position;
    240         }
    241        
    242         /**
    243         * Sets the image scale to 1.0
    244         */
    245         public void resetScale() {
    246                 m_scale = 1.0;
    247         }
    248 
    249         /**
    250         * Sets the image angle to 0.0
    251         */
    252         public void resetAngle() {
    253                 m_angle = 0.0;
    254         }
    255 
    256         @Override
    257         public void visitBoundingBox(BoundingXYVisitor arg0) {
    258                 // TODO Auto-generated method stub
    259 
    260         }
     137
     138    @Override
     139    public Icon getIcon() {
     140        return m_layericon;
     141    }
     142
     143    @Override
     144    public Object getInfoComponent() {
     145        // TODO Auto-generated method stub
     146        return null;
     147    }
     148
     149    @Override
     150    public Component[] getMenuEntries() {
     151        return m_popupmenu;
     152    }
     153
     154    @Override
     155    public String getToolTipText() {
     156        return getPicLayerName();
     157    }
     158
     159    @Override
     160    public boolean isMergable(Layer arg0) {
     161        // TODO Auto-generated method stub
     162        return false;
     163    }
     164
     165    @Override
     166    public void mergeFrom(Layer arg0) {
     167        // TODO Auto-generated method stub
     168
     169    }
     170
     171    @Override
     172    public void paint(Graphics arg0, MapView arg1) {
     173
     174        if ( m_image != null && arg0 instanceof Graphics2D) {
     175
     176            // Position image at the right graphical place
     177            EastNorth center = Main.map.mapView.getCenter();
     178            EastNorth leftop = Main.map.mapView.getEastNorth( 0, 0 );
     179            double pixel_per_en = ( Main.map.mapView.getWidth() / 2.0 ) / ( center.east() - leftop.east() );
     180
     181            //     This is now the offset in screen pixels
     182            double pic_offset_x = (( m_position.east() - leftop.east() ) * pixel_per_en);
     183            double pic_offset_y = (( leftop.north() - m_position.north() ) * pixel_per_en);
     184
     185            // Let's use Graphics 2D
     186            Graphics2D g = (Graphics2D)arg0.create();
     187            // Move
     188            g.translate( pic_offset_x, pic_offset_y );
     189            // Rotate
     190            g.rotate( m_angle * Math.PI / 180.0 );
     191            // Scale
     192            double scale = m_scale * m_initial_scale / Main.map.mapView.getMapScale();
     193            g.scale( scale, scale );
     194
     195            // Draw picture
     196            g.drawImage( m_image, -m_image.getWidth() / 2, -m_image.getHeight() / 2, null );
     197
     198            // Draw additional rectangle for the active pic layer
     199            if ( Main.map.mapView.getActiveLayer() == this ) {
     200                g.setColor( new Color( 0xFF0000 ) );
     201                g.drawRect(
     202                    -m_image.getWidth() / 2,
     203                    -m_image.getHeight() / 2,
     204                    m_image.getWidth(),
     205                    m_image.getHeight()
     206                );
     207            }
     208        } else {
     209            // TODO: proper logging
     210            System.out.println( "PicLayerAbstract::paint - general drawing error (m_image is null or Graphics not 2D" );
     211        }
     212    }
     213
     214    /**
     215    * Moves the picture. Scaled in EastNorth...
     216    */
     217    public void movePictureBy( double east, double north ) {
     218        m_position = m_position.add( east, north );
     219    }
     220
     221    /**
     222    * Scales the picture. Scaled in... don't know but works ok :)
     223    */
     224    public void scalePictureBy( double scale ) {
     225        m_scale += scale;
     226    }
     227
     228    /**
     229    * Rotates the picture. Scales in angles.
     230    */
     231    public void rotatePictureBy( double angle ) {
     232        m_angle += angle;
     233    }
     234
     235    /**
     236    * Sets the image position to the initial position
     237    */
     238    public void resetPosition() {
     239        m_position = m_initial_position;
     240    }
     241
     242    /**
     243    * Sets the image scale to 1.0
     244    */
     245    public void resetScale() {
     246        m_scale = 1.0;
     247    }
     248
     249    /**
     250    * Sets the image angle to 0.0
     251    */
     252    public void resetAngle() {
     253        m_angle = 0.0;
     254    }
     255
     256    @Override
     257    public void visitBoundingBox(BoundingXYVisitor arg0) {
     258        // TODO Auto-generated method stub
     259
     260    }
    261261}
  • applications/editors/josm/plugins/remotecontrol/build.xml

    r14015 r16290  
    2626                <attribute name="Plugin-Description" value="Let other applications send commands to JOSM."/>
    2727                <attribute name="Plugin-Link" value="http://wiki.openstreetmap.org/index.php/JOSM/Plugins/RemoteControl"/>
    28                 <attribute name="Plugin-Mainversion" value="1465"/>
     28                <attribute name="Plugin-Mainversion" value="1722"/>
    2929                <attribute name="Plugin-Version" value="${version.entry.commit.revision}"/>
    3030            </manifest>
  • applications/editors/josm/plugins/remotecontrol/src/org/openstreetmap/josm/plugins/remotecontrol/RequestProcessor.java

    r14893 r16290  
    1818import org.openstreetmap.josm.actions.AutoScaleAction;
    1919import org.openstreetmap.josm.actions.downloadtasks.DownloadOsmTask;
     20import org.openstreetmap.josm.data.Bounds;
    2021import org.openstreetmap.josm.data.coor.EastNorth;
    2122import org.openstreetmap.josm.data.coor.LatLon;
     
    194195                } else if (Main.pref.getBoolean("remotecontrol.permission.change-viewport", true)) {
    195196                    // after downloading, zoom to downloaded area.
    196                     final LatLon min = new LatLon(minlat, minlon);
    197                     final LatLon max = new LatLon(maxlat, maxlon);
     197                    final Bounds bounds = new Bounds(new LatLon(minlat, minlon),
     198                        new LatLon(maxlat, maxlon));
    198199
    199200                    Main.worker.execute(new Runnable() {
    200201                        public void run() {
    201202                            BoundingXYVisitor bbox = new BoundingXYVisitor();
    202                             bbox.min = Main.proj.latlon2eastNorth(min);
    203                             bbox.max = Main.proj.latlon2eastNorth(max);
     203                            bbox.visit(bounds);
    204204                            Main.map.mapView.recalculateCenterScale(bbox);
    205205                        }
  • applications/editors/josm/plugins/routing/build.xml

    r15707 r16290  
    4444                <attribute name="Plugin-Description" value="Provides routing capabilities."/>
    4545                <attribute name="Plugin-Link" value="http://wiki.openstreetmap.org/index.php/JOSM/Plugins/Routing"/>
    46                 <attribute name="Plugin-Mainversion" value="1646"/>
     46                <attribute name="Plugin-Mainversion" value="1722"/>
    4747                <attribute name="Plugin-Stage" value="50"/>
    4848                <attribute name="Plugin-Version" value="${version.entry.commit.revision}"/>
  • applications/editors/josm/plugins/routing/src/com/innovant/josm/jrt/core/RoutingGraph.java

    r15707 r16290  
    160160     */
    161161    private void addEdge(Way way,Node from, Node to) {
    162         double length = from.coor.greatCircleDistance(to.coor);
     162        double length = from.getCoor().greatCircleDistance(to.getCoor());
    163163
    164164        OsmEdge edge = new OsmEdge(way, from, to);
  • applications/editors/josm/plugins/routing/src/com/innovant/josm/jrt/osm/OsmEdge.java

    r15707 r16290  
    6969        this.from = from;
    7070        this.to = to;
    71         this.length = from.coor.greatCircleDistance(to.coor);
     71        this.length = from.getCoor().greatCircleDistance(to.getCoor());
    7272      }
    7373
     
    8080
    8181  public EastNorth fromEastNorth() {
    82       return this.from.eastNorth;
     82      return this.from.getEastNorth();
    8383  }
    8484
    8585  public EastNorth toEastNorth() {
    86       return this.to.eastNorth;
     86      return this.to.getEastNorth();
    8787  }
    8888
  • applications/editors/josm/plugins/routing/src/com/innovant/josm/plugin/routing/RoutingLayer.java

    r15707 r16290  
    139139                if (n.deleted || n.incomplete) continue;
    140140
    141                 Point P = Main.map.mapView.getPoint(n.eastNorth);
     141                Point P = Main.map.mapView.getPoint(n.getEastNorth());
    142142                double dist = p.distanceSq(P);
    143143                if (dist < NavigatableComponent.snapDistance) {
     
    275275        // paint start icon
    276276        Node node = nodes.get(0);
    277         Point screen = mv.getPoint(node.eastNorth);
     277        Point screen = mv.getPoint(node.getEastNorth());
    278278        startIcon.paintIcon(mv, g, screen.x - startIcon.getIconWidth()/2,
    279279                screen.y - startIcon.getIconHeight());
     
    282282        for(int index = 1; index < nodes.size() - 1; ++index) {
    283283            node = nodes.get(index);
    284             screen = mv.getPoint(node.eastNorth);
     284            screen = mv.getPoint(node.getEastNorth());
    285285            middleIcon.paintIcon(mv, g, screen.x - startIcon.getIconWidth()/2,
    286286                    screen.y - middleIcon.getIconHeight());
     
    289289        if(nodes.size() > 1) {
    290290            node = nodes.get(nodes.size() - 1);
    291             screen = mv.getPoint(node.eastNorth);
     291            screen = mv.getPoint(node.getEastNorth());
    292292            endIcon.paintIcon(mv, g, screen.x - startIcon.getIconWidth()/2,
    293293                    screen.y - endIcon.getIconHeight());
  • applications/editors/josm/plugins/routing/src/com/innovant/josm/plugin/routing/actions/MoveRouteNodeAction.java

    r15707 r16290  
    113113                for (int i=0;i<nl.size();i++) {
    114114                    Node node = nl.get(i);
    115                     double d = Main.map.mapView.getPoint(node.eastNorth).distanceSq(e.getPoint());
     115                    double d = Main.map.mapView.getPoint(node.getEastNorth()).distanceSq(e.getPoint());
    116116                    if (d < dmax) {
    117117                        dmax = d;
  • applications/editors/josm/plugins/routing/src/com/innovant/josm/plugin/routing/actions/RemoveRouteNodeAction.java

    r15707 r16290  
    102102                for (int i=0;i<nl.size();i++) {
    103103                    Node node = nl.get(i);
    104                     double d = Main.map.mapView.getPoint(node.eastNorth).distanceSq(e.getPoint());
     104                    double d = Main.map.mapView.getPoint(node.getEastNorth()).distanceSq(e.getPoint());
    105105                    if (d < dmax) {
    106106                        dmax = d;
  • applications/editors/josm/plugins/routing/src/com/innovant/josm/plugin/routing/gui/RoutingDialog.java

    r15707 r16290  
    125125     */
    126126    public void addNode(Node n) {
    127         model.addElement(n.id+" ["+n.coor.toDisplayString()+"]");
     127        model.addElement(n.id+" ["+n.getCoor().toDisplayString()+"]");
    128128    }
    129129
     
    134134     */
    135135    public void insertNode(int index, Node n) {
    136         model.insertElementAt(n.id+" ["+n.coor.toDisplayString()+"]", index);
     136        model.insertElementAt(n.id+" ["+n.getCoor().toDisplayString()+"]", index);
    137137    }
    138138
  • applications/editors/josm/plugins/surveyor/build.xml

    r14015 r16290  
    3737                <attribute name="Plugin-Description" value="Allow adding markers/nodes on current gps positions."/>
    3838                <attribute name="Plugin-Link" value="http://wiki.openstreetmap.org/index.php/JOSM/Plugins/Surveyor"/>
    39                 <attribute name="Plugin-Mainversion" value="1326"/>
     39                <attribute name="Plugin-Mainversion" value="1722"/>
    4040                <attribute name="Plugin-Requires" value="livegps"/>
    4141                <attribute name="Plugin-Stage" value="60"/>
  • applications/editors/josm/plugins/surveyor/src/at/dallermassl/josm/plugin/surveyor/SurveyorShowAction.java

    r13497 r16290  
    8181                public void actionPerformed(ActionEvent e) {
    8282                    if(Main.map != null && Main.map.mapView != null) {
    83                         Main.map.mapView.zoomTo(Main.map.mapView.getCenter(), Main.map.mapView.getScale()*2);
     83                        Main.map.mapView.zoomToFactor(2);
    8484                    }
    8585                }
     
    9090                public void actionPerformed(ActionEvent e) {
    9191                    if(Main.map != null && Main.map.mapView != null) {
    92                         Main.map.mapView.zoomTo(Main.map.mapView.getCenter(), Main.map.mapView.getScale()/2);
     92                        Main.map.mapView.zoomToFactor(1/2);
    9393                    }
    9494                }
  • applications/editors/josm/plugins/utilsplugin/build.xml

    r16162 r16290  
    2525                <attribute name="Plugin-Date" value="${version.entry.commit.date}"/>
    2626                <attribute name="Plugin-Description" value="Several utilities that make your life easier: e.g. simplify way, join areas, jump to position."/>
    27                 <attribute name="Plugin-Mainversion" value="1638"/>
     27                <attribute name="Plugin-Mainversion" value="1722"/>
    2828                <attribute name="Plugin-Version" value="${version.entry.commit.revision}"/>
    2929            </manifest>
  • applications/editors/josm/plugins/utilsplugin/src/UtilsPlugin/JumpToAction.java

    r16162 r16290  
    4343        lon.setText(java.lang.Double.toString(curPos.lon()));
    4444
    45         LatLon ll1 = Main.map.mapView.getLatLon(0,0);
    46         LatLon ll2 = Main.map.mapView.getLatLon(100,0);
    47         double dist = ll1.greatCircleDistance(ll2);
    48         zoomFactor = Main.map.mapView.getScale()/dist;
     45        double dist = Main.map.mapView.getDist100Pixel();
     46        zoomFactor = 1/dist;
    4947
    5048        zm.setText(java.lang.Long.toString(Math.round(dist*100)/100));
     
    116114        }
    117115
    118         Main.map.mapView.zoomTo(Main.proj.latlon2eastNorth(ll), zoomFactor * zoomLvl);
     116        Main.map.mapView.zoomToFactor(Main.proj.latlon2eastNorth(ll), zoomFactor * zoomLvl);
    119117    }
    120118
  • applications/editors/josm/plugins/validator/build.xml

    r16159 r16290  
    2626                <attribute name="Plugin-Description" value="An OSM data validator. It checks for problems in data, and provides fixes for the common ones. Spellcheck integrated for tag names."/>
    2727                <attribute name="Plugin-Link" value="http://wiki.openstreetmap.org/index.php/JOSM/Plugins/Validator"/>
    28                 <attribute name="Plugin-Mainversion" value="1638"/>
     28                <attribute name="Plugin-Mainversion" value="1722"/>
    2929                <attribute name="Plugin-Version" value="${version.entry.commit.revision}"/>
    3030            </manifest>
  • applications/editors/josm/plugins/validator/src/org/openstreetmap/josm/plugins/validator/ValidatorDialog.java

    r13497 r16290  
    262262        ValidatorBoundingXYVisitor bbox = new ValidatorBoundingXYVisitor();
    263263        popupMenuError.visitHighlighted(bbox);
    264         if (bbox.min == null || bbox.max == null)
     264        if (bbox.getBounds() == null)
    265265            return;
    266266        bbox.enlargeBoundingBox();
  • applications/editors/josm/plugins/waydownloader/build.xml

    r16177 r16290  
    9191                <attribute name="Plugin-Description" value="Easy downloading along a long set of interconnected ways"/>
    9292                <attribute name="Plugin-Link" value="http://wiki.openstreetmap.org/wiki/JOSM/Plugins/WayDownloaderPlugin"/>
    93                 <attribute name="Plugin-Mainversion" value="1"/>
     93                <attribute name="Plugin-Mainversion" value="1722"/>
    9494                <attribute name="Plugin-Version" value="${version.entry.commit.revision}"/>
    9595            </manifest>
  • applications/editors/josm/plugins/waydownloader/src/WayDownloaderPlugin.java

    r15412 r16290  
    2525/**
    2626 * Plugin class for the Way Downloader plugin
    27  * 
     27 *
    2828 * @author Harry Wood
    2929 */
    3030public class WayDownloaderPlugin extends Plugin {
    3131
    32         private Way priorConnectedWay = null;
    33         private Node selectedNode = null;
    34 
    35 
    36         /** Plugin constructor called at JOSM startup */
    37         public WayDownloaderPlugin() {
    38                 //add WayDownloadAction to tools menu
    39                 MainMenu.add(Main.main.menu.toolsMenu, new WayDownloadAction());
    40         }
    41        
    42         private class WayDownloadAction extends JosmAction implements Runnable {
    43 
    44                 /** Set up the action (text appearing on the menu, keyboard shortcut etc */
    45                 public WayDownloadAction() {
    46 
    47                         super( "Way Download" ,
    48                                         "way-download",
    49                                         "Download map data on the end of selected way",
    50                                         Shortcut.registerShortcut("waydownloader:waydownload", "Way Download", KeyEvent.VK_W, Shortcut.GROUP_MENU, Shortcut.SHIFT_DEFAULT),
    51                                         true);
    52                 }
    53 
    54                 /** Called when the WayDownloadAction action is triggered (e.g. user clicked the menu option) */
    55                 public void actionPerformed(ActionEvent e) {
    56                        
    57                         System.out.println("Way Download");
    58 
    59                         String errMsg = null;
    60                        
    61                         selectedNode = null;
    62                         Collection<OsmPrimitive> selection = Main.ds.getSelectedNodes();
    63                        
    64                         if (selection.size()==0) {
    65                                 selection = Main.ds.getSelectedWays();
    66                                 if (!workFromWaySelection(selection)) {
    67                                         errMsg = tr("Select a starting node on the end of a way");
    68                                 }
    69                                 selection = Main.ds.getSelectedNodes();
    70                         }
    71                        
    72                         if ( selection.size()==0 || selection.size()>1 ) {
    73                                 errMsg = tr("Select a starting node on the end of a way");
    74                         } else {
    75                                 OsmPrimitive p = selection.iterator().next();
    76 
    77                                
    78                                
    79                     if (!(p instanceof Node)) {
    80                                         errMsg = tr("Select a starting node on the end of a way");
    81                     } else {
    82                         selectedNode = (Node) p;
    83 
    84 
    85                         Main.map.mapView.zoomTo(selectedNode.eastNorth , Main.map.mapView.getScale());
    86                        
    87                         //Before downloading. Figure a few things out.
    88                         //Find connected way
    89                         ArrayList<Way> connectedWays = findConnectedWays();
    90                    
    91                         if (connectedWays.size()==0) {
    92                                                 errMsg = tr("Select a starting node on the end of a way");
    93                         } else {
    94                                 priorConnectedWay =(Way) connectedWays.get(0);
    95                                
    96                                 //Download a little rectangle around the selected node
    97                                 double latbuffer=0.0003; //TODO make this an option
    98                                 double lonbuffer=0.0005;
    99                                 DownloadOsmTask downloadTask = new DownloadOsmTask();
    100                                 downloadTask.download( null,
    101                                                selectedNode.coor.lat()-latbuffer,
    102                                                selectedNode.coor.lon()-lonbuffer,
    103                                                selectedNode.coor.lat()+latbuffer,
    104                                                selectedNode.coor.lon()+lonbuffer);
    105 
    106                             //The download is scheduled to be executed.
    107                                 //Now schedule the run() method (below) to be executed once that's completed.
    108                             Main.worker.execute(this);
    109                                
    110                         }
    111                     }
    112                         }
    113                        
    114                 if(errMsg != null)
    115                     JOptionPane.showMessageDialog(Main.parent, errMsg);
    116                
    117                
    118                 }
    119 
    120                 /**
    121                  * Logic to excute after the download has happened
    122                  */
    123                 public void run() {
    124                 //Find ways connected to the node after the download
    125                 ArrayList<Way> connectedWays = findConnectedWays();
    126                
    127                 String errMsg = null;
    128                         if (connectedWays.size()==0) {
    129                                 throw new RuntimeException("Way downloader data inconsistency. priorConnectedWay (" +
    130                                                 priorConnectedWay.toString() + ") wasn't discovered after download");
    131                                
    132                         } else if (connectedWays.size()==1) {
    133                                 //Just one way connecting the node still. Presumably the one which was there before
    134                                
    135                                 //Check if it's just a duplicate node
    136                                 Node dupeNode = duplicateNode();
    137                                 if (dupeNode!=null) {
    138 
    139                                         if (JOptionPane.showConfirmDialog(null, "Merge duplicate node?")==JOptionPane.YES_OPTION) {
    140                                                 LinkedList<Node> dupeNodes = new LinkedList<Node>();
    141                                                 dupeNodes.add(dupeNode);
    142                                         MergeNodesAction.mergeNodes(dupeNodes, selectedNode);
    143 
    144                                                 connectedWays = findConnectedWays(); //Carry on
    145                                         }
    146                            
    147                                        
    148                                 } else {
    149                                         errMsg = tr("Reached the end of the line");
    150                                 }
    151                                
    152                 }
    153 
    154                         if (connectedWays.size()>2) {
    155                         //Three or more ways meeting at this node. Means we have a junction.
    156                                 errMsg = tr("Reached a junction");
    157                                
    158                 } else if (connectedWays.size()==2) {
    159                         //Two connected ways (The "normal" way downloading case)
    160                         //Figure out which of the two is new.
    161                         System.out.println("connectedWays.toString()=" + connectedWays.toString());
    162                         Way wayA = (Way) connectedWays.get(0);
    163                         Way wayB = (Way) connectedWays.get(1);
    164                         Way nextWay = wayA;
    165                         if (priorConnectedWay.equals(wayA)) nextWay = wayB;
    166 
    167                         Node nextNode = findOtherEnd(nextWay, selectedNode);
    168                
    169                         //Select the next node
    170                         Main.ds.setSelected(nextNode);
    171                        
    172                 Main.map.mapView.zoomTo(nextNode.eastNorth , Main.map.mapView.getScale());
    173                        
    174                 }
    175                 if(errMsg != null)
    176                     JOptionPane.showMessageDialog(Main.parent, errMsg);
    177                 }
    178         }
    179 
    180         /** See if there's another node at the same coordinates. If so return it. Otherwise null */
    181         private Node duplicateNode() {
    182                 Iterator nodesIter = Main.ds.nodes.iterator();
    183         while (nodesIter.hasNext()) {
    184                 Node onNode = (Node) nodesIter.next();
    185                 if (!onNode.equals(this.selectedNode)
    186                                 && onNode.coor.lat()==selectedNode.coor.lat()
    187                                 && onNode.coor.lon()==selectedNode.coor.lon()) {
    188                         return onNode;
    189                 }
    190         }
    191                 return null;
    192         }
    193        
    194         /** Given the the node on one end of the way, return the node on the other end */
    195         private Node findOtherEnd(Way way, Node firstEnd) {
    196                 Node otherEnd = way.nodes.get(0);
    197                 if (otherEnd.equals(firstEnd)) otherEnd = way.nodes.get(way.nodes.size()-1);
    198                 return otherEnd;
    199         }
    200        
    201         /** find set of ways which have an end on the selectedNode */
    202         private ArrayList<Way> findConnectedWays() {
    203                 ArrayList<Way> connectedWays = new ArrayList<Way>();
    204                
    205                 //loop through every way
    206                 Iterator waysIter = Main.ds.ways.iterator();
    207                 while (waysIter.hasNext()) {
    208                         Way onWay = (Way) waysIter.next();
    209 
    210 
    211                         Object[] nodes = onWay.nodes.toArray();
    212                         if (nodes.length<2) {
    213                                 //Should never happen should it? TODO: investigate. For the moment ignore these
    214                                 System.err.println("WayDownloader plugin encountered a way with " + nodes.length + " nodes :" + onWay.toString());
    215                         } else {
    216                                 Node firstNode = (Node) nodes[0];
    217                                 Node lastNode = (Node) nodes[nodes.length-1];
    218 
    219                                 if (firstNode.equals(selectedNode) || lastNode.equals(selectedNode)) {
    220                                         //Found it
    221                                         connectedWays.add(onWay);
    222                                 }
    223                         }
    224                 }
    225                 return connectedWays;
    226         }
    227        
    228         /**
    229          * given a selected way, select a node on the end of the way which is not in a downloaded area
    230          * return true if this worked
    231          */
    232         private boolean workFromWaySelection(Collection<OsmPrimitive> selection) {
    233                
    234                 if (selection.size()>1) {
    235                         //more than one way selected
    236                         return false;
    237                 } else {
    238                         Way selectedWay = (Way) selection.toArray()[0];
    239                         selectedNode = (Node) selectedWay.nodes.get(0);
     32    private Way priorConnectedWay = null;
     33    private Node selectedNode = null;
     34
     35
     36    /** Plugin constructor called at JOSM startup */
     37    public WayDownloaderPlugin() {
     38        //add WayDownloadAction to tools menu
     39        MainMenu.add(Main.main.menu.toolsMenu, new WayDownloadAction());
     40    }
     41
     42    private class WayDownloadAction extends JosmAction implements Runnable {
     43
     44        /** Set up the action (text appearing on the menu, keyboard shortcut etc */
     45        public WayDownloadAction() {
     46
     47            super( "Way Download" ,
     48                    "way-download",
     49                    "Download map data on the end of selected way",
     50                    Shortcut.registerShortcut("waydownloader:waydownload", "Way Download", KeyEvent.VK_W, Shortcut.GROUP_MENU, Shortcut.SHIFT_DEFAULT),
     51                    true);
     52        }
     53
     54        /** Called when the WayDownloadAction action is triggered (e.g. user clicked the menu option) */
     55        public void actionPerformed(ActionEvent e) {
     56
     57            System.out.println("Way Download");
     58
     59            String errMsg = null;
     60
     61            selectedNode = null;
     62            Collection<OsmPrimitive> selection = Main.ds.getSelectedNodes();
     63
     64            if (selection.size()==0) {
     65                selection = Main.ds.getSelectedWays();
     66                if (!workFromWaySelection(selection)) {
     67                    errMsg = tr("Select a starting node on the end of a way");
     68                }
     69                selection = Main.ds.getSelectedNodes();
     70            }
     71
     72            if ( selection.size()==0 || selection.size()>1 ) {
     73                errMsg = tr("Select a starting node on the end of a way");
     74            } else {
     75                OsmPrimitive p = selection.iterator().next();
     76
     77
     78
     79                if (!(p instanceof Node)) {
     80                    errMsg = tr("Select a starting node on the end of a way");
     81                } else {
     82                    selectedNode = (Node) p;
     83
     84
     85                    Main.map.mapView.zoomTo(selectedNode.getEastNorth());
     86
     87                    //Before downloading. Figure a few things out.
     88                    //Find connected way
     89                    ArrayList<Way> connectedWays = findConnectedWays();
     90
     91                    if (connectedWays.size()==0) {
     92                        errMsg = tr("Select a starting node on the end of a way");
     93                    } else {
     94                        priorConnectedWay =(Way) connectedWays.get(0);
     95
     96                        //Download a little rectangle around the selected node
     97                        double latbuffer=0.0003; //TODO make this an option
     98                        double lonbuffer=0.0005;
     99                        DownloadOsmTask downloadTask = new DownloadOsmTask();
     100                        downloadTask.download( null,
     101                                               selectedNode.getCoor().lat()-latbuffer,
     102                                               selectedNode.getCoor().lon()-lonbuffer,
     103                                               selectedNode.getCoor().lat()+latbuffer,
     104                                               selectedNode.getCoor().lon()+lonbuffer);
     105
     106                        //The download is scheduled to be executed.
     107                        //Now schedule the run() method (below) to be executed once that's completed.
     108                        Main.worker.execute(this);
     109                    }
     110                }
     111            }
     112
     113            if(errMsg != null)
     114                JOptionPane.showMessageDialog(Main.parent, errMsg);
     115        }
     116
     117        /**
     118         * Logic to excute after the download has happened
     119         */
     120        public void run() {
     121            //Find ways connected to the node after the download
     122            ArrayList<Way> connectedWays = findConnectedWays();
     123
     124            String errMsg = null;
     125            if (connectedWays.size()==0) {
     126                throw new RuntimeException("Way downloader data inconsistency. priorConnectedWay (" +
     127                        priorConnectedWay.toString() + ") wasn't discovered after download");
     128
     129            } else if (connectedWays.size()==1) {
     130                //Just one way connecting the node still. Presumably the one which was there before
     131
     132                //Check if it's just a duplicate node
     133                Node dupeNode = duplicateNode();
     134                if (dupeNode!=null) {
     135
     136                    if (JOptionPane.showConfirmDialog(null, "Merge duplicate node?")==JOptionPane.YES_OPTION) {
     137                        LinkedList<Node> dupeNodes = new LinkedList<Node>();
     138                        dupeNodes.add(dupeNode);
     139                        MergeNodesAction.mergeNodes(dupeNodes, selectedNode);
     140
     141                        connectedWays = findConnectedWays(); //Carry on
     142                    }
     143
     144
     145                } else {
     146                    errMsg = tr("Reached the end of the line");
     147                }
     148
     149            }
     150
     151            if (connectedWays.size()>2) {
     152                //Three or more ways meeting at this node. Means we have a junction.
     153                errMsg = tr("Reached a junction");
     154
     155            } else if (connectedWays.size()==2) {
     156                //Two connected ways (The "normal" way downloading case)
     157                //Figure out which of the two is new.
     158                System.out.println("connectedWays.toString()=" + connectedWays.toString());
     159                Way wayA = (Way) connectedWays.get(0);
     160                Way wayB = (Way) connectedWays.get(1);
     161                Way nextWay = wayA;
     162                if (priorConnectedWay.equals(wayA)) nextWay = wayB;
     163
     164                Node nextNode = findOtherEnd(nextWay, selectedNode);
     165
     166                //Select the next node
     167                Main.ds.setSelected(nextNode);
     168
     169                Main.map.mapView.zoomTo(nextNode.getEastNorth());
     170            }
     171            if(errMsg != null)
     172                JOptionPane.showMessageDialog(Main.parent, errMsg);
     173        }
     174    }
     175
     176    /** See if there's another node at the same coordinates. If so return it. Otherwise null */
     177    private Node duplicateNode() {
     178        Iterator nodesIter = Main.ds.nodes.iterator();
     179        while (nodesIter.hasNext()) {
     180            Node onNode = (Node) nodesIter.next();
     181            if (!onNode.equals(this.selectedNode)
     182                    && onNode.getCoor().lat()==selectedNode.getCoor().lat()
     183                    && onNode.getCoor().lon()==selectedNode.getCoor().lon()) {
     184                return onNode;
     185            }
     186        }
     187        return null;
     188    }
     189
     190    /** Given the the node on one end of the way, return the node on the other end */
     191    private Node findOtherEnd(Way way, Node firstEnd) {
     192        Node otherEnd = way.nodes.get(0);
     193        if (otherEnd.equals(firstEnd)) otherEnd = way.nodes.get(way.nodes.size()-1);
     194        return otherEnd;
     195    }
     196
     197    /** find set of ways which have an end on the selectedNode */
     198    private ArrayList<Way> findConnectedWays() {
     199        ArrayList<Way> connectedWays = new ArrayList<Way>();
     200
     201        //loop through every way
     202        Iterator waysIter = Main.ds.ways.iterator();
     203        while (waysIter.hasNext()) {
     204            Way onWay = (Way) waysIter.next();
     205
     206
     207            Object[] nodes = onWay.nodes.toArray();
     208            if (nodes.length<2) {
     209                //Should never happen should it? TODO: investigate. For the moment ignore these
     210                System.err.println("WayDownloader plugin encountered a way with " + nodes.length + " nodes :" + onWay.toString());
     211            } else {
     212                Node firstNode = (Node) nodes[0];
     213                Node lastNode = (Node) nodes[nodes.length-1];
     214
     215                if (firstNode.equals(selectedNode) || lastNode.equals(selectedNode)) {
     216                    //Found it
     217                    connectedWays.add(onWay);
     218                }
     219            }
     220        }
     221        return connectedWays;
     222    }
     223
     224    /**
     225     * given a selected way, select a node on the end of the way which is not in a downloaded area
     226     * return true if this worked
     227     */
     228    private boolean workFromWaySelection(Collection<OsmPrimitive> selection) {
     229
     230        if (selection.size()>1) {
     231            //more than one way selected
     232            return false;
     233        } else {
     234            Way selectedWay = (Way) selection.toArray()[0];
     235            selectedNode = (Node) selectedWay.nodes.get(0);
    240236
    241237            if (isDownloaded(selectedNode)) {
    242                                 selectedNode = findOtherEnd(selectedWay, selectedNode);
    243                                
     238                selectedNode = findOtherEnd(selectedWay, selectedNode);
     239
    244240                if (isDownloaded(selectedNode)) return false;
    245                         }
    246                 }
    247                 Main.ds.setSelected(selectedNode);
    248                 return true;
    249         }
    250        
    251         private boolean isDownloaded(Node node) {
    252                 Iterator downloadedAreasIter = Main.ds.dataSources.iterator();
    253                 while (downloadedAreasIter.hasNext()) {
    254                         DataSource datasource = (DataSource) downloadedAreasIter.next();
    255                         Bounds bounds = datasource.bounds;
    256 
    257                         if (node.coor.lat()>bounds.min.lat() &&
    258                                 node.coor.lat()<bounds.max.lat() &&
    259                                 node.coor.lon()>bounds.min.lon() &&
    260                                 node.coor.lon()<bounds.max.lon()) {
    261                                 return true;
    262                         }
    263                 }
    264                 return false;
    265         }
     241            }
     242        }
     243        Main.ds.setSelected(selectedNode);
     244        return true;
     245    }
     246
     247    private boolean isDownloaded(Node node) {
     248        Iterator downloadedAreasIter = Main.ds.dataSources.iterator();
     249        while (downloadedAreasIter.hasNext()) {
     250            DataSource datasource = (DataSource) downloadedAreasIter.next();
     251            Bounds bounds = datasource.bounds;
     252
     253            if (node.getCoor().lat()>bounds.min.lat() &&
     254                node.getCoor().lat()<bounds.max.lat() &&
     255                node.getCoor().lon()>bounds.min.lon() &&
     256                node.getCoor().lon()<bounds.max.lon()) {
     257                return true;
     258            }
     259        }
     260        return false;
     261    }
    266262}
  • applications/editors/josm/plugins/wmsplugin/build.xml

    r15707 r16290  
    2929                <attribute name="Plugin-Description" value="Display georeferenced images as background in JOSM (WMS servers, Yahoo, ...)."/>
    3030                <attribute name="Plugin-Link" value="http://wiki.openstreetmap.org/wiki/JOSM/Plugins/WMSPlugin"/>
    31                 <attribute name="Plugin-Mainversion" value="1646"/>
     31                <attribute name="Plugin-Mainversion" value="1722"/>
    3232                <attribute name="Plugin-Version" value="${version.entry.commit.revision}"/>
    3333                <attribute name="de_Plugin-Link" value="http://wiki.openstreetmap.org/wiki/DE:JOSM/Plugins/WMSPlugin"/>
  • applications/editors/josm/plugins/wmsplugin/src/wmsplugin/Grabber.java

    r15858 r16290  
    99
    1010import org.openstreetmap.josm.Main;
    11 import org.openstreetmap.josm.data.Bounds;
    12 import org.openstreetmap.josm.data.coor.LatLon;
     11import org.openstreetmap.josm.data.ProjectionBounds;
     12import org.openstreetmap.josm.data.coor.EastNorth;
    1313import org.openstreetmap.josm.data.projection.Projection;
    1414import org.openstreetmap.josm.gui.MapView;
     
    1616
    1717abstract public class Grabber implements Runnable {
    18     protected Bounds b;
     18    protected ProjectionBounds b;
    1919    protected Projection proj;
    2020    protected double pixelPerDegree;
     
    2424    protected CacheFiles cache;
    2525
    26     Grabber(Bounds b, GeorefImage image, MapView mv, WMSLayer layer, CacheFiles cache)
     26    Grabber(ProjectionBounds b, GeorefImage image, MapView mv, WMSLayer layer, CacheFiles cache)
    2727    {
    28         if (b.min != null && b.max != null && WMSPlugin.doOverlap)
    29         {
    30             double latCent = (b.min.lat() + b.max.lat()) / 2;
    31             double lonCent = (b.min.lon() + b.max.lon()) / 2;
    32 
    33             double latSize =  b.max.lat() - b.min.lat();
    34             double lonSize =  b.max.lon() - b.min.lon();
    35 
    36             double latCoef = (100.0 + WMSPlugin.overlapLat) / 100.0 / 2.0;
    37             double lonCoef = (100.0 + WMSPlugin.overlapLon) / 100.0 / 2.0;
    38 
    39             this.b = new Bounds( new LatLon(latCent - latCoef * latSize,
    40                                             lonCent - lonCoef * lonSize),
    41                                  new LatLon(latCent + latCoef * latSize,
    42                                             lonCent + lonCoef * lonSize));
    43         }
    44         else
    45             this.b = b;
    46 
     28        this.b = b;
    4729        this.proj = Main.main.proj;
    4830        this.pixelPerDegree = layer.pixelPerDegree;
     
    5638
    5739    int width(){
    58         return (int) ((b.max.lon() - b.min.lon()) * pixelPerDegree);
     40        return (int) ((b.max.north() - b.min.north()) * pixelPerDegree);
    5941    }
    6042    int height(){
    61         return (int) ((b.max.lat() - b.min.lat()) * pixelPerDegree);
     43        return (int) ((b.max.east() - b.min.east()) * pixelPerDegree);
    6244    }
    6345
  • applications/editors/josm/plugins/wmsplugin/src/wmsplugin/WMSGrabber.java

    r15961 r16290  
    2424
    2525import org.openstreetmap.josm.Main;
    26 import org.openstreetmap.josm.data.Bounds;
     26import org.openstreetmap.josm.data.ProjectionBounds;
     27import org.openstreetmap.josm.data.coor.EastNorth;
     28import org.openstreetmap.josm.data.coor.LatLon;
     29import org.openstreetmap.josm.data.projection.Epsg4326;
     30import org.openstreetmap.josm.data.projection.Mercator;
    2731import org.openstreetmap.josm.gui.MapView;
    2832import org.openstreetmap.josm.io.CacheFiles;
     
    3539    private final boolean urlWithPatterns;
    3640
    37     WMSGrabber(Bounds b, GeorefImage image, MapView mv, WMSLayer layer, CacheFiles cache) {
     41    WMSGrabber(ProjectionBounds b, GeorefImage image, MapView mv, WMSLayer layer, CacheFiles cache) {
    3842        super(b, image, mv, layer, cache);
    3943        this.baseURL = layer.baseURL;
     
    5155        try {
    5256            url = getURL(
    53                 b.min.lon(), b.min.lat(),
    54                 b.max.lon(), b.max.lat(),
     57                b.min.east(), b.min.north(),
     58                b.max.east(), b.max.north(),
    5559                width(), height());
    5660
    57             image.min = proj.latlon2eastNorth(b.min);
    58             image.max = proj.latlon2eastNorth(b.max);
     61            image.min = b.min;
     62            image.max = b.max;
    5963
     64System.out.println(url + " " + b + " " + image.min + " " + image.max);
    6065            if(image.isVisible(mv)) { //don't download, if the image isn't visible already
    6166                image.image = grab(url);
     
    7378    protected URL getURL(double w, double s,double e,double n,
    7479            int wi, int ht) throws MalformedURLException {
     80        String proj = Main.proj.toCode();
     81        if(Main.proj instanceof Mercator) // don't use mercator code directly
     82        {
     83            LatLon sw = Main.proj.eastNorth2latlon(new EastNorth(s, w));
     84            LatLon ne = Main.proj.eastNorth2latlon(new EastNorth(n, e));
     85            proj = "EPSG:4326";
     86            s = sw.lat();
     87            w = sw.lon();
     88            n = ne.lat();
     89            e = ne.lon();
     90        }
     91/*        else if(!(Main.proj instanceof Epsg4326))
     92        {
     93            EastNorth sw = Main.proj.latlon2eastNorth(new LatLon(s, w));
     94            EastNorth ne = Main.proj.latlon2eastNorth(new LatLon(n, e));
     95            s = sw.north();
     96            w = sw.east();
     97            n = ne.north();
     98            e = ne.east();
     99        }
     100*/
    75101        String str = baseURL;
    76102        String bbox = latLonFormat.format(w) + ","
     
    80106
    81107        if (urlWithPatterns) {
    82             String proj = Main.proj.toCode();
    83             if(Main.proj instanceof org.openstreetmap.josm.data.projection.Mercator) // don't use mercator code directly
    84                 proj = "EPSG:4326";
    85 
    86108            str = MessageFormat.format(str, proj, bbox, wi, ht);
    87109        } else {
     
    99121    {
    100122        String projname = Main.proj.toCode();
    101         if(Main.proj instanceof org.openstreetmap.josm.data.projection.Mercator) // don't use mercator code
     123        if(Main.proj instanceof Mercator) // don't use mercator code
    102124            projname = "EPSG:4326";
    103125        String res = "";
  • applications/editors/josm/plugins/wmsplugin/src/wmsplugin/WMSLayer.java

    r15858 r16290  
    2626import org.openstreetmap.josm.Main;
    2727import org.openstreetmap.josm.actions.DiskAccessAction;
    28 import org.openstreetmap.josm.data.Bounds;
     28import org.openstreetmap.josm.data.ProjectionBounds;
    2929import org.openstreetmap.josm.data.coor.EastNorth;
    3030import org.openstreetmap.josm.data.coor.LatLon;
     
    7979        WMSGrabber.getProjection(baseURL, true);
    8080        mv = Main.map.mapView;
    81         getPPD();
     81        pixelPerDegree = getPPD();
    8282
    8383        executor = Executors.newFixedThreadPool(3);
     
    9292    }
    9393
    94     public void getPPD(){
    95         pixelPerDegree = mv.getWidth() / (bounds().max.lon() - bounds().min.lon());
     94    public double getPPD(){
     95        ProjectionBounds bounds = mv.getProjectionBounds();
     96        return mv.getWidth() / (bounds.max.east() - bounds.min.east());
    9697    }
    9798
     
    128129    }
    129130
    130     private Bounds XYtoBounds (int x, int y) {
    131         return new Bounds(
    132             new LatLon(      x * ImageSize / pixelPerDegree,       y * ImageSize / pixelPerDegree),
    133             new LatLon((x + 1) * ImageSize / pixelPerDegree, (y + 1) * ImageSize / pixelPerDegree));
     131    private ProjectionBounds XYtoBounds (int x, int y) {
     132        return new ProjectionBounds(
     133            new EastNorth(      x * ImageSize / pixelPerDegree,       y * ImageSize / pixelPerDegree),
     134            new EastNorth((x + 1) * ImageSize / pixelPerDegree, (y + 1) * ImageSize / pixelPerDegree));
    134135    }
    135136
     
    138139    }
    139140
    140     protected Bounds bounds(){
    141         return new Bounds(
    142             mv.getLatLon(0, mv.getHeight()),
    143             mv.getLatLon(mv.getWidth(), 0));
    144     }
    145 
    146141    @Override public void paint(Graphics g, final MapView mv) {
    147142        if(baseURL == null) return;
    148143
    149         if( !startstop.isSelected() || (pixelPerDegree / (mv.getWidth() / (bounds().max.lon() - bounds().min.lon())) > minZoom) ){ //don't download when it's too outzoomed
     144        if( !startstop.isSelected() || (pixelPerDegree / getPPD() > minZoom) ){ //don't download when it's too outzoomed
    150145            for(int x = 0; x<dax; ++x)
    151146                for(int y = 0; y<day; ++y)
     
    161156
    162157    protected void downloadAndPaintVisible(Graphics g, final MapView mv){
    163         int bminx= (int)Math.floor ((bounds().min.lat() * pixelPerDegree ) / ImageSize );
    164         int bminy= (int)Math.floor ((bounds().min.lon() * pixelPerDegree ) / ImageSize );
    165         int bmaxx= (int)Math.ceil  ((bounds().max.lat() * pixelPerDegree ) / ImageSize );
    166         int bmaxy= (int)Math.ceil  ((bounds().max.lon() * pixelPerDegree ) / ImageSize );
     158        ProjectionBounds bounds = mv.getProjectionBounds();
     159        int bminx= (int)Math.floor ((bounds.min.east() * pixelPerDegree ) / ImageSize );
     160        int bminy= (int)Math.floor ((bounds.min.north() * pixelPerDegree ) / ImageSize );
     161        int bmaxx= (int)Math.ceil  ((bounds.max.east() * pixelPerDegree ) / ImageSize );
     162        int bmaxy= (int)Math.ceil  ((bounds.max.north() * pixelPerDegree ) / ImageSize );
    167163
    168164        if((bmaxx - bminx > dax) || (bmaxy - bminy > day)){
     
    241237            initializeImages();
    242238            resolution = scale();
    243             getPPD();
     239            pixelPerDegree = getPPD();
    244240            mv.repaint();
    245241        }
  • applications/editors/josm/plugins/wmsplugin/src/wmsplugin/WMSPlugin.java

    r15858 r16290  
    2525import org.openstreetmap.josm.Main;
    2626import org.openstreetmap.josm.actions.JosmAction;
    27 import org.openstreetmap.josm.data.Bounds;
     27import org.openstreetmap.josm.data.ProjectionBounds;
    2828import org.openstreetmap.josm.gui.IconToggleButton;
    2929import org.openstreetmap.josm.gui.MainMenu;
     
    4343    static ArrayList<WMSInfo> wmsList = new ArrayList<WMSInfo>();
    4444    static TreeMap<String,String> wmsListDefault = new TreeMap<String,String>();
    45 
    46     static boolean doOverlap = false;
    47     static int overlapLat = 4;
    48     static int overlapLon = 14;
    4945
    5046    // remember state of menu item to restore on changed preferences
     
    8985
    9086        TreeSet<String> keys = new TreeSet<String>(prefs.keySet());
    91 
    92         // Here we load the settings for "overlap" checkbox and spinboxes.
    93 
    94         try {
    95             doOverlap = Boolean.valueOf(prefs.get("wmsplugin.url.overlap"));
    96         } catch (Exception e) {} // If sth fails, we drop to default settings.
    97 
    98         try {
    99             overlapLat = Integer.valueOf(prefs.get("wmsplugin.url.overlapLat"));
    100         } catch (Exception e) {} // If sth fails, we drop to default settings.
    101 
    102         try {
    103             overlapLon = Integer.valueOf(prefs.get("wmsplugin.url.overlapLon"));
    104         } catch (Exception e) {} // If sth fails, we drop to default settings.
    10587
    10688        // And then the names+urls of WMS servers
     
    207189    }
    208190
    209     // baseURL, XYtoBounds(x,y), Main.main.proj, pixelPerDegree, img, mv, this
    210     // Grabber gr = WMSPlugin.getGrabber(XYtoBounds(x,y), img, mv, this);
    211     public static Grabber getGrabber(Bounds bounds, GeorefImage img, MapView mv, WMSLayer layer){
     191    public static Grabber getGrabber(ProjectionBounds bounds, GeorefImage img, MapView mv, WMSLayer layer){
    212192        if(layer.baseURL.startsWith("yahoo://"))
    213193            return new YAHOOGrabber(bounds, img, mv, layer, cache);
    214194        else
    215195            return new WMSGrabber(bounds, img, mv, layer, cache);
    216 
    217         // OSBGrabber should be rewrite for thread support first
    218         //if (wmsurl.matches("(?i).*layers=npeoocmap.*") || wmsurl.matches("(?i).*layers=npe.*") )
    219         //  return new OSGBGrabber(_b, _proj, _pixelPerDegree,  _images, _mv, _layer);
    220196    }
    221197
  • applications/editors/josm/plugins/wmsplugin/src/wmsplugin/WMSPreferenceEditor.java

    r15940 r16290  
    3333    private DefaultTableModel model;
    3434    private HashMap<Integer, WMSInfo> oldValues = new HashMap<Integer, WMSInfo>();
    35 
    36     JCheckBox overlapCheckBox;
    37     JSpinner spinLat;
    38     JSpinner spinLon;
    3935
    4036    public void addGui(final PreferenceDialog gui) {
     
    117113        p.add(buttonPanel);
    118114        p.add(Box.createHorizontalGlue(), GBC.eol().fill(GBC.HORIZONTAL));
    119 
    120         overlapCheckBox = new JCheckBox(tr("Overlap tiles"), WMSPlugin.doOverlap );
    121         JLabel labelLat = new JLabel(tr("% of lat:"));
    122         JLabel labelLon = new JLabel(tr("% of lon:"));
    123         spinLat = new JSpinner(new SpinnerNumberModel(WMSPlugin.overlapLat, 1, 50, 1));
    124         spinLon = new JSpinner(new SpinnerNumberModel(WMSPlugin.overlapLon, 1, 50, 1));
    125 
    126         JPanel overlapPanel = new JPanel(new FlowLayout());
    127         overlapPanel.add(overlapCheckBox);
    128         overlapPanel.add(labelLat);
    129         overlapPanel.add(spinLat);
    130         overlapPanel.add(labelLon);
    131         overlapPanel.add(spinLon);
    132 
    133         p.add(overlapPanel);
    134115    }
    135116
     
    170151
    171152        if (change) WMSPlugin.refreshMenu();
    172 
    173         WMSPlugin.doOverlap = overlapCheckBox.getModel().isSelected();
    174         WMSPlugin.overlapLat = (Integer) spinLat.getModel().getValue();
    175         WMSPlugin.overlapLon = (Integer) spinLon.getModel().getValue();
    176 
    177         Main.pref.put("wmsplugin.url.overlap",    String.valueOf(WMSPlugin.doOverlap));
    178         Main.pref.put("wmsplugin.url.overlapLat", String.valueOf(WMSPlugin.overlapLat));
    179         Main.pref.put("wmsplugin.url.overlapLon", String.valueOf(WMSPlugin.overlapLon));
    180153
    181154        return false;
  • applications/editors/josm/plugins/wmsplugin/src/wmsplugin/YAHOOGrabber.java

    r15890 r16290  
    1010import javax.imageio.ImageIO;
    1111
    12 import org.openstreetmap.josm.data.Bounds;
     12import org.openstreetmap.josm.data.ProjectionBounds;
    1313import org.openstreetmap.josm.gui.MapView;
    1414import org.openstreetmap.josm.io.CacheFiles;
     
    1818    protected String browserCmd;
    1919
    20     YAHOOGrabber(Bounds b, GeorefImage image, MapView mv, WMSLayer layer, CacheFiles cache) {
     20    YAHOOGrabber(ProjectionBounds b, GeorefImage image, MapView mv, WMSLayer layer, CacheFiles cache) {
    2121        super(b, image, mv, layer, cache);
    2222        this.baseURL = "file:///" + WMSPlugin.getPrefsPath() + "ymap.html?";
Note: See TracChangeset for help on using the changeset viewer.