Show OLC in addition to lat/lon in point descriptions

This commit is contained in:
theirix 2017-01-08 17:15:09 +03:00
parent 3bb1c287b7
commit b565be0149
3 changed files with 20 additions and 0 deletions

View file

@ -22,6 +22,7 @@ import net.osmand.plus.GPXUtilities.WptPt;
import net.osmand.plus.GpxSelectionHelper.GpxDisplayItem;
import net.osmand.plus.MapMarkersHelper.MapMarker;
import net.osmand.plus.OsmandApplication;
import net.osmand.plus.OsmandSettings;
import net.osmand.plus.R;
import net.osmand.plus.TargetPointsHelper.TargetPoint;
import net.osmand.plus.activities.MapActivity;
@ -203,8 +204,12 @@ public abstract class MenuController extends BaseMenuController {
}
protected void addMyLocationToPlainItems(LatLon latLon) {
OsmandSettings st = ((OsmandApplication) getMapActivity().getApplicationContext()).getSettings();
addPlainMenuItem(R.drawable.ic_action_get_my_location, PointDescription.getLocationName(getMapActivity(),
latLon.getLatitude(), latLon.getLongitude(), true).replaceAll("\n", " "), false, false, null);
if (st.COORDINATES_FORMAT.get() != PointDescription.OLC_FORMAT)
addPlainMenuItem(R.drawable.ic_action_get_my_location, PointDescription.getLocationOlcName(
latLon.getLatitude(), latLon.getLongitude()).replaceAll("\n", " "), false, false, null);
}
public PointDescription getPointDescription() {

View file

@ -24,6 +24,8 @@ import net.osmand.data.PointDescription;
import net.osmand.osm.AbstractPoiType;
import net.osmand.osm.MapPoiTypes;
import net.osmand.osm.PoiType;
import net.osmand.plus.OsmandApplication;
import net.osmand.plus.OsmandSettings;
import net.osmand.plus.R;
import net.osmand.plus.activities.MapActivity;
import net.osmand.plus.mapcontextmenu.MenuBuilder;
@ -464,9 +466,15 @@ public class AmenityMenuBuilder extends MenuBuilder {
buildAmenityRow(view, wikiInfo);
}
OsmandSettings st = ((OsmandApplication) mapActivity.getApplicationContext()).getSettings();
buildRow(view, R.drawable.ic_action_get_my_location, PointDescription.getLocationName(app,
amenity.getLocation().getLatitude(), amenity.getLocation().getLongitude(), true)
.replaceAll("\n", " "), 0, false, null, false, 0, false, null);
if (st.COORDINATES_FORMAT.get() != PointDescription.OLC_FORMAT)
buildRow(view, R.drawable.ic_action_get_my_location, PointDescription.getLocationOlcName(
amenity.getLocation().getLatitude(), amenity.getLocation().getLongitude())
.replaceAll("\n", " "), 0, false, null, false, 0, false, null);
}
public void buildAmenityRow(View view, AmenityInfoRow info) {

View file

@ -5,6 +5,8 @@ import android.view.View;
import net.osmand.data.PointDescription;
import net.osmand.osm.MapPoiTypes;
import net.osmand.osm.PoiType;
import net.osmand.plus.OsmandApplication;
import net.osmand.plus.OsmandSettings;
import net.osmand.plus.R;
import net.osmand.plus.activities.MapActivity;
import net.osmand.plus.mapcontextmenu.MenuBuilder;
@ -71,8 +73,13 @@ public class EditPOIMenuBuilder extends MenuBuilder {
}
}
OsmandSettings st = ((OsmandApplication) mapActivity.getApplicationContext()).getSettings();
buildRow(view, R.drawable.ic_action_get_my_location, PointDescription.getLocationName(app,
osmPoint.getLatitude(), osmPoint.getLongitude(), true)
.replaceAll("\n", " "), 0, false, null, false, 0, false, null);
if (st.COORDINATES_FORMAT.get() != PointDescription.OLC_FORMAT)
buildRow(view, R.drawable.ic_action_get_my_location, PointDescription.getLocationOlcName(
osmPoint.getLatitude(), osmPoint.getLongitude())
.replaceAll("\n", " "), 0, false, null, false, 0, false, null);
}
}