kopia lustrzana https://github.com/JOSM/MapWithAI
Don't allow users to select data sources when there is no data layer
This fixes #91. Signed-off-by: Taylor Smock <taylor.smock@kaart.com>pull/1/head
rodzic
fd73d6a88b
commit
0122707e27
|
@ -116,7 +116,8 @@ public class AddMapWithAILayerAction extends JosmAction implements AdaptableActi
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void updateEnabledState() {
|
protected void updateEnabledState() {
|
||||||
setEnabled(!info.isBlacklisted() && (MapWithAIDataUtils.getLayer(false) == null
|
setEnabled(!info.isBlacklisted() && MainApplication.getLayerManager().getActiveDataLayer() != null
|
||||||
|
&& (MapWithAIDataUtils.getLayer(false) == null
|
||||||
|| !MapWithAIDataUtils.getLayer(false).hasDownloaded(info)));
|
|| !MapWithAIDataUtils.getLayer(false).hasDownloaded(info)));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -133,7 +133,7 @@ public class MapWithAIMenu extends JMenu {
|
||||||
if (MainApplication.isDisplayingMapView()) {
|
if (MainApplication.isDisplayingMapView()) {
|
||||||
MapView mv = MainApplication.getMap().mapView;
|
MapView mv = MainApplication.getMap().mapView;
|
||||||
LatLon pos = mv.getProjection().eastNorth2latlon(mv.getCenter());
|
LatLon pos = mv.getProjection().eastNorth2latlon(mv.getCenter());
|
||||||
final List<MapWithAIInfo> inViewLayers = MapWithAILayerInfo.getInstance().getDefaultLayers().stream()
|
final List<MapWithAIInfo> inViewLayers = MapWithAILayerInfo.getInstance().getAllDefaultLayers().stream()
|
||||||
.filter(i -> i.getBounds() != null && i.getBounds().contains(pos) && !alreadyInUse.contains(i)
|
.filter(i -> i.getBounds() != null && i.getBounds().contains(pos) && !alreadyInUse.contains(i)
|
||||||
&& !savedLayers.contains(i) && isPosInOneShapeIfAny(i, pos))
|
&& !savedLayers.contains(i) && isPosInOneShapeIfAny(i, pos))
|
||||||
.sorted(alphabeticSourceComparator).collect(Collectors.toList());
|
.sorted(alphabeticSourceComparator).collect(Collectors.toList());
|
||||||
|
@ -162,7 +162,7 @@ public class MapWithAIMenu extends JMenu {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (dynamicNonPhotoItems.isEmpty()) {
|
if (dynJosmActions.isEmpty()) {
|
||||||
JosmAction infoAction = new JosmAction() {
|
JosmAction infoAction = new JosmAction() {
|
||||||
@Override
|
@Override
|
||||||
public void actionPerformed(ActionEvent e) {
|
public void actionPerformed(ActionEvent e) {
|
||||||
|
|
Ładowanie…
Reference in New Issue