Bind water polygons with land ones for underlay maps
This commit is contained in:
parent
8ff6eff178
commit
b8f3452a1c
1 changed files with 15 additions and 6 deletions
|
@ -66,21 +66,29 @@ public class RasterMapMenu {
|
||||||
|
|
||||||
final CommonPreference<Boolean> hidePolygonsPref =
|
final CommonPreference<Boolean> hidePolygonsPref =
|
||||||
mapActivity.getMyApplication().getSettings().getCustomRenderBooleanProperty("noPolygons");
|
mapActivity.getMyApplication().getSettings().getCustomRenderBooleanProperty("noPolygons");
|
||||||
|
final CommonPreference<Boolean> hideWaterPolygonsPref =
|
||||||
|
mapActivity.getMyApplication().getSettings().getCustomRenderBooleanProperty("hideWaterPolygons");
|
||||||
|
|
||||||
|
|
||||||
String mapTypeDescr = mapTypePreference.get();
|
String mapTypeDescr = mapTypePreference.get();
|
||||||
if (mapTypeDescr!=null && mapTypeDescr.contains(".sqlitedb")) {
|
if (mapTypeDescr!=null && mapTypeDescr.contains(".sqlitedb")) {
|
||||||
mapTypeDescr = mapTypeDescr.replaceFirst(".sqlitedb", "");
|
mapTypeDescr = mapTypeDescr.replaceFirst(".sqlitedb", "");
|
||||||
}
|
}
|
||||||
|
|
||||||
final boolean selected = mapTypeDescr != null;
|
final boolean mapSelected = mapTypeDescr != null;
|
||||||
final int toggleActionStringId = selected ? R.string.shared_string_on
|
final int toggleActionStringId = mapSelected ? R.string.shared_string_on
|
||||||
: R.string.shared_string_off;
|
: R.string.shared_string_off;
|
||||||
|
|
||||||
|
if (mapSelected && type == RasterMapType.UNDERLAY) {
|
||||||
|
hideWaterPolygonsPref.set(hidePolygonsPref.get());
|
||||||
|
}
|
||||||
|
|
||||||
final OnMapSelectedCallback onMapSelectedCallback =
|
final OnMapSelectedCallback onMapSelectedCallback =
|
||||||
new OnMapSelectedCallback() {
|
new OnMapSelectedCallback() {
|
||||||
@Override
|
@Override
|
||||||
public void onMapSelected(boolean canceled) {
|
public void onMapSelected(boolean canceled) {
|
||||||
mapActivity.getDashboard().refreshContent(true);
|
mapActivity.getDashboard().refreshContent(true);
|
||||||
|
hideWaterPolygonsPref.set(hidePolygonsPref.get());
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
final MapActivityLayers mapLayers = mapActivity.getMapLayers();
|
final MapActivityLayers mapLayers = mapActivity.getMapLayers();
|
||||||
|
@ -89,7 +97,7 @@ public class RasterMapMenu {
|
||||||
public boolean onRowItemClick(ArrayAdapter<ContextMenuItem> adapter,
|
public boolean onRowItemClick(ArrayAdapter<ContextMenuItem> adapter,
|
||||||
View view, int itemId, int pos) {
|
View view, int itemId, int pos) {
|
||||||
if (itemId == mapTypeString) {
|
if (itemId == mapTypeString) {
|
||||||
if (selected) {
|
if (mapSelected) {
|
||||||
plugin.selectMapOverlayLayer(mapActivity.getMapView(), mapTypePreference,
|
plugin.selectMapOverlayLayer(mapActivity.getMapView(), mapTypePreference,
|
||||||
exMapTypePreference, true, mapActivity, onMapSelectedCallback);
|
exMapTypePreference, true, mapActivity, onMapSelectedCallback);
|
||||||
}
|
}
|
||||||
|
@ -111,6 +119,7 @@ public class RasterMapMenu {
|
||||||
});
|
});
|
||||||
} else if (itemId == R.string.show_polygons) {
|
} else if (itemId == R.string.show_polygons) {
|
||||||
hidePolygonsPref.set(!isChecked);
|
hidePolygonsPref.set(!isChecked);
|
||||||
|
hideWaterPolygonsPref.set(!isChecked);
|
||||||
mapActivity.refreshMapComplete();
|
mapActivity.refreshMapComplete();
|
||||||
} else if (itemId == R.string.show_transparency_seekbar) {
|
} else if (itemId == R.string.show_transparency_seekbar) {
|
||||||
if (isChecked) {
|
if (isChecked) {
|
||||||
|
@ -126,13 +135,13 @@ public class RasterMapMenu {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
mapTypeDescr = selected ? mapTypeDescr : mapActivity.getString(R.string.shared_string_none);
|
mapTypeDescr = mapSelected ? mapTypeDescr : mapActivity.getString(R.string.shared_string_none);
|
||||||
contextMenuAdapter.addItem(new ContextMenuItem.ItemBuilder()
|
contextMenuAdapter.addItem(new ContextMenuItem.ItemBuilder()
|
||||||
.setTitleId(toggleActionStringId, mapActivity)
|
.setTitleId(toggleActionStringId, mapActivity)
|
||||||
.hideDivider(true)
|
.hideDivider(true)
|
||||||
.setListener(l)
|
.setListener(l)
|
||||||
.setSelected(selected).createItem());
|
.setSelected(mapSelected).createItem());
|
||||||
if (selected) {
|
if (mapSelected) {
|
||||||
contextMenuAdapter.addItem(new ContextMenuItem.ItemBuilder()
|
contextMenuAdapter.addItem(new ContextMenuItem.ItemBuilder()
|
||||||
.setTitleId(mapTypeString, mapActivity)
|
.setTitleId(mapTypeString, mapActivity)
|
||||||
.hideDivider(true)
|
.hideDivider(true)
|
||||||
|
|
Loading…
Reference in a new issue