Fix MapWithAI layer switching with ctrl+r

Signed-off-by: Taylor Smock <tsmock@meta.com>
pull/41/head v815
Taylor Smock 2023-10-02 09:58:20 -06:00
rodzic bac594e719
commit 9c3e9c0879
Nie znaleziono w bazie danych klucza dla tego podpisu
ID klucza GPG: 233BB2E466604E27
5 zmienionych plików z 9 dodań i 12 usunięć

Wyświetl plik

@ -34,6 +34,7 @@ import java.util.stream.Collectors;
import org.openstreetmap.josm.actions.ExpertToggleAction;
import org.openstreetmap.josm.data.Bounds;
import org.openstreetmap.josm.data.DataSource;
import org.openstreetmap.josm.data.osm.DataSet;
import org.openstreetmap.josm.data.osm.DownloadPolicy;
import org.openstreetmap.josm.data.osm.Node;
@ -255,6 +256,9 @@ public class MapWithAILayer extends OsmDataLayer implements ActiveLayerChangeLis
public void onPostDownloadFromServer(Bounds bounds) {
super.onPostDownloadFromServer();
GetDataRunnable.cleanup(getDataSet(), bounds, null);
if (!this.data.getDataSourceBounds().contains(bounds)) {
this.data.addDataSource(new DataSource(bounds, null));
}
}
@Override

Wyświetl plik

@ -16,7 +16,7 @@
},
"response" : {
"status" : 200,
"body" : "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<osm generator=\"NS_ROADS_SERVICE\" version=\"0.6\">\n <bounds maxlat=\"-1.0E-5\" maxlon=\"-1.0000000000381E-5\" minlat=\"-0.00099\" minlon=\"-0.00098999999999962\"/>\n</osm>\n",
"body" : "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<osm generator=\"NS_ROADS_SERVICE\" version=\"0.6\">\n <bounds maxlat=\"0.0\" maxlon=\"0.0\" minlat=\"-0.001\" minlon=\"-0.001\"/>\n</osm>\n",
"headers" : {
"Content-Type" : "text/xml; charset=UTF-8",
"Strict-Transport-Security" : "max-age=15552000; preload",

Wyświetl plik

@ -17,7 +17,7 @@
},
"response" : {
"status" : 200,
"body" : "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<osm generator=\"NS_ROADS_SERVICE\" version=\"0.6\"><bounds maxlat=\"0.00099\" maxlon=\"0.00098999999999962\" minlat=\"1.0E-5\" minlon=\"1.0000000000381E-5\"/></osm>\n",
"body" : "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<osm generator=\"NS_ROADS_SERVICE\" version=\"0.6\"><bounds maxlat=\"0.001\" maxlon=\"0.001\" minlat=\"0.0\" minlon=\"0.0\"/></osm>\n",
"headers" : {
"Content-Type" : "text/xml; charset=UTF-8",
"X-XSS-Protection" : "0",

Wyświetl plik

@ -16,7 +16,7 @@
},
"response" : {
"status" : 200,
"body" : "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<osm generator=\"NS_ROADS_SERVICE\" version=\"0.6\">\n <bounds maxlat=\"0.00099\" maxlon=\"0.00098999999999962\" minlat=\"1.0E-5\" minlon=\"1.0000000000381E-5\"/>\n</osm>\n",
"body" : "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<osm generator=\"NS_ROADS_SERVICE\" version=\"0.6\">\n <bounds maxlat=\"0.001\" maxlon=\"0.001\" minlat=\"0.0\" minlon=\"0.0\"/>\n</osm>\n",
"headers" : {
"Content-Type" : "text/xml; charset=UTF-8",
"Strict-Transport-Security" : "max-age=15552000; preload",

Wyświetl plik

@ -27,7 +27,6 @@ import org.awaitility.Durations;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.RegisterExtension;
import org.openstreetmap.josm.TestUtils;
import org.openstreetmap.josm.data.Bounds;
import org.openstreetmap.josm.data.DataSource;
@ -46,19 +45,16 @@ import org.openstreetmap.josm.plugins.mapwithai.backend.MapWithAILayer.Continuou
import org.openstreetmap.josm.plugins.mapwithai.commands.MapWithAIAddCommand;
import org.openstreetmap.josm.plugins.mapwithai.data.mapwithai.MapWithAIInfo;
import org.openstreetmap.josm.plugins.mapwithai.testutils.MapWithAIPluginMock;
import org.openstreetmap.josm.plugins.mapwithai.testutils.MapWithAITestRules;
import org.openstreetmap.josm.plugins.mapwithai.testutils.annotations.MapWithAISources;
import org.openstreetmap.josm.plugins.mapwithai.testutils.annotations.Wiremock;
import org.openstreetmap.josm.plugins.mapwithai.tools.MapPaintUtils;
import org.openstreetmap.josm.spi.preferences.Config;
import org.openstreetmap.josm.testutils.JOSMTestRules;
import org.openstreetmap.josm.testutils.annotations.BasicPreferences;
import org.openstreetmap.josm.testutils.annotations.Main;
import org.openstreetmap.josm.testutils.annotations.OsmApi;
import org.openstreetmap.josm.testutils.annotations.Projection;
import org.openstreetmap.josm.testutils.annotations.Territories;
import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
/**
* Test class for {@link MapWithAILayer}
*
@ -67,14 +63,11 @@ import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
@BasicPreferences
@Main
@MapWithAISources
@OsmApi(OsmApi.APIType.FAKE)
@Projection
@Territories(Territories.Initialize.ALL)
@Wiremock
class MapWithAILayerTest {
@RegisterExtension
@SuppressFBWarnings("URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
static JOSMTestRules test = new MapWithAITestRules().main().fakeAPI();
MapWithAILayer layer;
@BeforeAll