Ignore:
Timestamp:
2017-08-26T20:45:43+02:00 (7 years ago)
Author:
zverik
Message:

Upgrade API for geochat

File:
1 edited

Legend:

Unmodified
Added
Removed
  • applications/editors/josm/plugins/geochat/src/geochat/ChatServerConnection.java

    r32544 r33545  
    2323import org.openstreetmap.josm.data.coor.LatLon;
    2424import org.openstreetmap.josm.data.projection.Projection;
     25import org.openstreetmap.josm.gui.MainApplication;
    2526import org.openstreetmap.josm.gui.MapView;
     27import org.openstreetmap.josm.tools.Logging;
    2628
    2729/**
     
    122124                    }
    123125                } catch (InterruptedException e) {
    124                     Main.warn(e);
     126                    Logging.warn(e);
    125127                }
    126128                autoLogin(userName);
     
    164166            });
    165167        } catch (UnsupportedEncodingException e) {
    166             Main.error(e);
     168            Logging.error(e);
    167169        }
    168170    }
     
    266268            });
    267269        } catch (UnsupportedEncodingException e) {
    268             Main.error(e);
     270            Logging.error(e);
    269271        }
    270272    }
     
    274276     */
    275277    private static LatLon getPosition() {
    276         if (Main.map == null || Main.map.mapView == null)
     278        if (!MainApplication.isDisplayingMapView())
    277279            return null;
    278280        if (getCurrentZoom() < 10)
    279281            return null;
    280282        Projection proj = Main.getProjection();
    281         return proj.eastNorth2latlon(Main.map.mapView.getCenter());
     283        return proj.eastNorth2latlon(MainApplication.getMap().mapView.getCenter());
    282284    }
    283285
     
    294296
    295297    public static int getCurrentZoom() {
    296         if (Main.map == null || Main.map.mapView == null) {
     298        if (!MainApplication.isDisplayingMapView()) {
    297299            return 1;
    298300        }
    299         MapView mv = Main.map.mapView;
     301        MapView mv = MainApplication.getMap().mapView;
    300302        LatLon topLeft = mv.getLatLon(0, 0);
    301303        LatLon botRight = mv.getLatLon(mv.getWidth(), mv.getHeight());
     
    434436                    result.add(cm);
    435437                } catch (JsonException e) {
    436                     Main.trace(e);
     438                    Logging.trace(e);
    437439                }
    438440            }
     
    450452                    result.put(name, new LatLon(lat, lon));
    451453                } catch (JsonException e) {
    452                     Main.trace(e);
     454                    Logging.trace(e);
    453455                }
    454456            }
Note: See TracChangeset for help on using the changeset viewer.