Clean up impassable roads layer.

This commit is contained in:
GaidamakUA 2016-01-12 09:51:06 +02:00
parent 6f53f471c4
commit 9764dd5bc8
2 changed files with 4 additions and 23 deletions

View file

@ -42,6 +42,7 @@ public class PointDescription {
public static final String POINT_TYPE_WORLD_REGION = "world_region"; public static final String POINT_TYPE_WORLD_REGION = "world_region";
public static final String POINT_TYPE_GPX_ITEM = "gpx_item"; public static final String POINT_TYPE_GPX_ITEM = "gpx_item";
public static final String POINT_TYPE_WORLD_REGION_SHOW_ON_MAP = "world_region_show_on_map"; public static final String POINT_TYPE_WORLD_REGION_SHOW_ON_MAP = "world_region_show_on_map";
public static final String POINT_TYPE_BLOCKED_ROAD = "blocked_road";
public static final PointDescription LOCATION_POINT = new PointDescription(POINT_TYPE_LOCATION, ""); public static final PointDescription LOCATION_POINT = new PointDescription(POINT_TYPE_LOCATION, "");

View file

@ -13,10 +13,6 @@ import net.osmand.data.PointDescription;
import net.osmand.data.RotatedTileBox; import net.osmand.data.RotatedTileBox;
import net.osmand.plus.R; import net.osmand.plus.R;
import net.osmand.plus.activities.MapActivity; import net.osmand.plus.activities.MapActivity;
import net.osmand.plus.osmedit.OpenstreetmapPoint;
import net.osmand.plus.osmedit.OsmEditingPlugin;
import net.osmand.plus.osmedit.OsmNotesPoint;
import net.osmand.plus.osmedit.OsmPoint;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
@ -129,35 +125,19 @@ public class ImpassableRoadsLayer extends OsmandMapLayer implements ContextMenuL
@Override @Override
public LatLon getObjectLocation(Object o) { public LatLon getObjectLocation(Object o) {
if (o instanceof OsmPoint) {
return new LatLon(((OsmPoint)o).getLatitude(),((OsmPoint)o).getLongitude());
}
return null; return null;
} }
@Override @Override
public String getObjectDescription(Object o) { public String getObjectDescription(Object o) {
if(o instanceof OsmPoint) {
OsmPoint point = (OsmPoint) o;
return OsmEditingPlugin.getEditName(point);
}
return null; return null;
} }
@Override @Override
public PointDescription getObjectName(Object o) { public PointDescription getObjectName(Object o) {
if(o instanceof OsmPoint) { if(o instanceof RouteDataObject) {
OsmPoint point = (OsmPoint) o; RouteDataObject route = (RouteDataObject) o;
String name = ""; return new PointDescription(PointDescription.POINT_TYPE_BLOCKED_ROAD, route.getName());
String type = "";
if (point.getGroup() == OsmPoint.Group.POI){
name = ((OpenstreetmapPoint) point).getName();
type = PointDescription.POINT_TYPE_OSM_NOTE;
} else if (point.getGroup() == OsmPoint.Group.BUG) {
name = ((OsmNotesPoint) point).getText();
type = PointDescription.POINT_TYPE_OSM_BUG;
}
return new PointDescription(type, name);
} }
return null; return null;
} }