X-Git-Url: http://gitweb.fperrin.net/?p=GpsPrune.git;a=blobdiff_plain;f=tim%2Fprune%2Fgui%2Fmap%2FMapCanvas.java;h=a62b10855ce14d25299f41e891f1b432999c4aff;hp=a6d5a8861fb62600b9e006f36b29d7466d9dd456;hb=326f489e36aa7f235bc19409a57bf4955cd50f24;hpb=8c8868ae29b3252f02e094c02307384cf61ba667 diff --git a/tim/prune/gui/map/MapCanvas.java b/tim/prune/gui/map/MapCanvas.java index a6d5a88..a62b108 100644 --- a/tim/prune/gui/map/MapCanvas.java +++ b/tim/prune/gui/map/MapCanvas.java @@ -31,6 +31,7 @@ import javax.swing.JMenuItem; import javax.swing.JPanel; import javax.swing.JPopupMenu; import javax.swing.JSlider; +import javax.swing.SwingUtilities; import javax.swing.event.ChangeEvent; import javax.swing.event.ChangeListener; @@ -57,12 +58,13 @@ import tim.prune.function.compress.MarkPointsInRectangleFunction; import tim.prune.function.edit.FieldEdit; import tim.prune.function.edit.FieldEditList; import tim.prune.gui.IconManager; +import tim.prune.tips.TipManager; /** * Class for the map canvas, to display a background map and draw on it */ public class MapCanvas extends JPanel implements MouseListener, MouseMotionListener, DataSubscriber, - KeyListener, MouseWheelListener + KeyListener, MouseWheelListener, TileConsumer { /** App object for callbacks */ private App _app = null; @@ -292,6 +294,8 @@ public class MapCanvas extends JPanel implements MouseListener, MouseMotionListe add(_scaleBar, BorderLayout.SOUTH); // Make popup menu makePopup(); + // Get currently selected map from Config, pass to MapTileManager + _tileManager.setMapSource(Config.getConfigInt(Config.KEY_MAPSOURCE_INDEX)); } @@ -508,8 +512,19 @@ public class MapCanvas extends JPanel implements MouseListener, MouseMotionListe g.fillRect(0, 0, getWidth(), getHeight()); // Check whether maps are on or not - boolean showMap = Config.getConfigBoolean(Config.KEY_SHOW_MAP); + final boolean showMap = Config.getConfigBoolean(Config.KEY_SHOW_MAP); _mapCheckBox.setSelected(showMap); + // Check whether disk cache is on or not + final boolean usingDiskCache = Config.getConfigString(Config.KEY_DISK_CACHE) != null; + // Show tip to recommend setting up a cache + if (showMap && !usingDiskCache && Config.getConfigBoolean(Config.KEY_ONLINE_MODE)) + { + SwingUtilities.invokeLater(new Runnable() { + public void run() { + _app.showTip(TipManager.Tip_UseAMapCache); + } + }); + } // reset error message if (!showMap) {_shownOsmErrorAlready = false;} @@ -544,7 +559,7 @@ public class MapCanvas extends JPanel implements MouseListener, MouseMotionListe // Loop over layers for (int l=0; l 0) { - _tileManager.resetConfig(); + // Get the selected map source index and pass to tile manager + _tileManager.setMapSource(Config.getConfigInt(Config.KEY_MAPSOURCE_INDEX)); } if ((inUpdateType & (DataSubscriber.DATA_ADDED_OR_REMOVED + DataSubscriber.DATA_EDITED)) > 0) { _midpoints.updateData(_track);