Alexey Kulish 2016-02-29 19:44:56 +03:00
parent d9834f7d5b
commit 8e3b32880a
2 changed files with 29 additions and 29 deletions

View file

@ -17,31 +17,41 @@ import java.util.List;
public class TransportStopController extends MenuController {
public enum TransportStopType {
BUS(R.drawable.mx_route_bus_ref),
FERRY(R.drawable.mx_route_ferry_ref),
FUNICULAR(R.drawable.mx_route_funicular_ref),
LIGHT_RAIL(R.drawable.mx_route_light_rail_ref),
MONORAIL(R.drawable.mx_route_monorail_ref),
RAILWAY(R.drawable.mx_route_railway_ref),
SHARE_TAXI(R.drawable.mx_route_share_taxi_ref),
TRAIN(R.drawable.mx_route_train_ref),
TRAM(R.drawable.mx_route_tram_ref),
TROLLEYBUS(R.drawable.mx_route_trolleybus_ref),
SUBWAY(R.drawable.mx_subway_station);
BUS(R.drawable.mx_route_bus_ref, R.drawable.mx_route_bus_ref),
FERRY(R.drawable.mx_route_ferry_ref, R.drawable.mx_route_ferry_ref),
FUNICULAR(R.drawable.mx_route_funicular_ref, R.drawable.mx_route_funicular_ref),
LIGHT_RAIL(R.drawable.mx_route_light_rail_ref, R.drawable.mx_route_light_rail_ref),
MONORAIL(R.drawable.mx_route_monorail_ref, R.drawable.mx_route_monorail_ref),
RAILWAY(R.drawable.mx_route_railway_ref, R.drawable.mx_route_railway_ref),
SHARE_TAXI(R.drawable.mx_route_share_taxi_ref, R.drawable.mx_route_share_taxi_ref),
TRAIN(R.drawable.mx_route_train_ref, R.drawable.mx_route_train_ref),
TRAM(R.drawable.mx_route_tram_ref, R.drawable.mx_railway_tram_stop),
TROLLEYBUS(R.drawable.mx_route_trolleybus_ref, R.drawable.mx_route_trolleybus_ref),
SUBWAY(R.drawable.mx_subway_station, R.drawable.mx_subway_station);
final static TransportStopType[] ALL_TYPES = new TransportStopType[]
{BUS, FERRY, FUNICULAR, LIGHT_RAIL, MONORAIL, RAILWAY, SHARE_TAXI, TRAIN, TRAM, TROLLEYBUS, SUBWAY};
final int resId;
final int topResId;
TransportStopType(int resId) {
TransportStopType(int resId, int topResId) {
this.resId = resId;
this.topResId = topResId;
}
public int getResourceId() {
return resId;
}
public int getTopResourceId() {
return topResId;
}
public boolean isTopType() {
return this == TRAM || this == SUBWAY;
}
public static TransportStopType findType(String typeName) {
String tName = typeName.toUpperCase();
for (TransportStopType t : ALL_TYPES) {
@ -56,7 +66,7 @@ public class TransportStopController extends MenuController {
private TransportStop transportStop;
private List<List<TransportStopRoute>> routes = new ArrayList<>();
private boolean hasTramRoute;
private TransportStopType topType;
public TransportStopController(OsmandApplication app, MapActivity mapActivity,
PointDescription pointDescription, TransportStop transportStop) {
@ -80,10 +90,10 @@ public class TransportStopController extends MenuController {
@Override
public int getLeftIconId() {
if (!hasTramRoute) {
if (topType == null) {
return R.drawable.mx_public_transport;
} else {
return R.drawable.mx_railway_tram_stop;
return topType.getTopResourceId();
}
}
@ -109,10 +119,11 @@ public class TransportStopController extends MenuController {
if (r.type == null) {
addPlainMenuItem(R.drawable.ic_action_polygom_dark, r.desc, false, false);
} else {
addPlainMenuItem(r.type.resId, r.desc, false, false);
addPlainMenuItem(r.type.getResourceId(), r.desc, false, false);
}
}
}
super.addPlainMenuItems(typeStr, pointDescription, latLon);
}
private void processTransportStop() {
@ -146,8 +157,8 @@ public class TransportStopController extends MenuController {
r.desc = s.substring(firstSpaceIndex + 1);
}
routeList.add(r);
if (!hasTramRoute && type != null && type == TransportStopType.TRAM) {
hasTramRoute = true;
if (topType == null && type != null && type.isTopType()) {
topType = type;
}
}
}

View file

@ -126,17 +126,6 @@ public class TransportStopsLayer extends OsmandMapLayer implements ContextMenuLa
DrawSettings settings) {
if (tileBox.getZoom() >= startZoom) {
objects.clear();
/*
view.getApplication().getResourceManager().searchTransportAsync(latLonBounds.top, latLonBounds.left,
latLonBounds.bottom, latLonBounds.right, tileBox.getZoom(), objects);
int r = 3 * getRadiusPoi(tileBox) / 4;
for (TransportStop o : objects) {
int x = tileBox.getPixXFromLonNoRot(o.getLocation().getLongitude());
int y = tileBox.getPixYFromLatNoRot(o.getLocation().getLatitude());
canvas.drawRect(x - r, y - r, x + r, y + r, pointAltUI);
}
*/
float iconSize = stopBus.getWidth() * 3 / 2.5f;
QuadTree<QuadRect> boundIntersections = initBoundIntersections(tileBox);