private void updateOffset() { if (Main.map == null || Main.map.mapView == null) return; EastNorth center = Main.map.mapView.getCenter(); if (center.equals(oldCenter)) return; oldCenter = center; EastNorth offset = offsetServer.getOffset(getInfo(), center); if (offset != null) { setOffset(offset.east(), offset.north()); } }
@Override public void run() { if (!offsetServerSupported) { if (!offsetServer.isLayerSupported(info)) return; offsetServerSupported = true; } offsetServerUsed = true; SwingUtilities.invokeLater( new Runnable() { @Override public void run() { Main.main.menu.imageryMenu.refreshOffsetMenu(); } }); try { while (offsetServerUsed) { updateOffset(); Thread.sleep(1000); } } catch (InterruptedException e) { } offsetServerUsed = false; }