fixin small bugs
git-svn-id: https://osmand.googlecode.com/svn/trunk@282 e29c36b1-1cfa-d876-8d93-3434fc2bb7b8
This commit is contained in:
parent
7de3b2dd96
commit
92453b435c
12 changed files with 98 additions and 41 deletions
|
@ -24,9 +24,7 @@ public class ToDoConstants {
|
|||
// 60. Audio guidance for routing
|
||||
// 61. Provide route information for YOURS (calclate turns/angle/expected time).
|
||||
// Fix some missing turns in CloudMade (for secondary roads wo name). Add them (if dist to prev/next turn > 150m) [dacha]
|
||||
// 33. Build transport locations. Create transport index (transport-stops) (investigate)
|
||||
// DONE : Load transport routes in swing, init
|
||||
// TODO : add show on map key stops, update current stop with gps, add transport activity to map (remove tab)
|
||||
|
||||
|
||||
|
||||
// 66. Transport routing (show next stop, total distance, show stop get out).
|
||||
|
@ -46,6 +44,8 @@ public class ToDoConstants {
|
|||
// FIXME !!!! Check agains ID is not unique ! (for relation/node/way - it could be the same) - checked for data extraction & index creator
|
||||
// REFACTOR Settings activity ( for check box properties!)
|
||||
// Download index show current index information
|
||||
// Fix bugs with test data (bug with follow turn / left time / add turn)
|
||||
// Fix description on android
|
||||
|
||||
// TODO swing
|
||||
// 9. Fix issues with big files (such as netherlands) - save memory (!) - very slow due to transport index !
|
||||
|
@ -57,7 +57,8 @@ public class ToDoConstants {
|
|||
// BUGS Swing
|
||||
|
||||
// DONE ANDROID :
|
||||
|
||||
// 33. Build transport locations. Create transport index (transport-stops) (investigate)
|
||||
// Not implemented : show key/transit stops on map, follow mode (show next stop)
|
||||
|
||||
// DONE SWING
|
||||
|
||||
|
|
|
@ -106,7 +106,7 @@ public abstract class MapObject implements Comparable<MapObject> {
|
|||
|
||||
@Override
|
||||
public String toString() {
|
||||
return getClass().getSimpleName() + " " + name +"("+id+")";
|
||||
return getClass().getSimpleName() + " " + name +"("+id+")"; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
android:layout_width="100dp" android:layout_height="wrap_content" android:layout_gravity="bottom|right">></com.osmand.views.OsmZoomControls >
|
||||
|
||||
<ImageButton android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity="bottom|left" android:id="@+id/BackToMenu" android:background="@drawable/back_menu"></ImageButton>
|
||||
<ImageButton android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity="top|right" android:id="@+id/BackToLocation" android:background="@drawable/back_location"></ImageButton>
|
||||
<ImageButton android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity="top|right" android:layout_marginTop="32px" android:id="@+id/BackToLocation" android:background="@drawable/back_location"></ImageButton>
|
||||
|
||||
|
||||
</FrameLayout>
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
android:layout_height="wrap_content" android:layout_below="@+id/listView"
|
||||
></ListView>
|
||||
<ListView android:id="@+id/listView" android:layout_width="fill_parent"
|
||||
android:layout_alignParentTop="true" android:layout_height="wrap_content"></ListView>
|
||||
android:layout_alignParentTop="true" android:layout_height="wrap_content" ></ListView>
|
||||
|
||||
</RelativeLayout>
|
||||
|
||||
|
|
|
@ -3,11 +3,12 @@
|
|||
xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<group android:id="@+id/map_context_menu" android:menuCategory="container">
|
||||
<item android:title="@string/mark_point" android:id="@+id/map_mark_point" android:icon="@android:drawable/ic_menu_mylocation"></item>
|
||||
<item android:title="@string/show_gps_status" android:id="@+id/map_show_gps_status" android:icon="@android:drawable/ic_menu_compass"></item>
|
||||
<item android:id="@+id/map_navigate_to_point" android:title="@string/stop_navigation" android:visible="false" android:icon="@android:drawable/ic_menu_close_clear_cancel"></item>
|
||||
<item android:id="@+id/map_get_directions" android:title="@string/get_directions" android:icon="@android:drawable/ic_menu_directions"></item>
|
||||
<item android:title="@string/map_specify_point" android:id="@+id/map_specify_point" android:icon="@android:drawable/ic_menu_search"></item>
|
||||
<item android:id="@+id/map_transport" android:title="@string/transport"></item>
|
||||
<item android:id="@+id/map_show_settings" android:title="@string/settings_Button" android:icon="@android:drawable/ic_menu_preferences"></item>
|
||||
<item android:title="@string/map_specify_point" android:id="@+id/map_specify_point" android:icon="@android:drawable/ic_menu_search"></item>
|
||||
<item android:title="@string/show_gps_status" android:id="@+id/map_show_gps_status" android:icon="@android:drawable/ic_menu_compass"></item>
|
||||
</group>
|
||||
|
||||
|
||||
|
|
|
@ -1,13 +1,14 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
<string name="transport_Routes">Маршруты</string>
|
||||
<string name="transport_Stop">Остановка</string>
|
||||
<string name="transport_stops">остановок</string>
|
||||
<string name="transport_searching_transport">Искать транспорт (нет цели)</string>
|
||||
<string name="transport_searching_route">Искать {0} маршрут </string>
|
||||
<string name="transport_search_none">нету</string>
|
||||
<string name="transport_search_after">Искать маршрут после</string>
|
||||
<string name="transport_search_before">Искать маршрут до</string>
|
||||
<string name="transport_finish_search">Остановить поиск</string>
|
||||
<string name="transport_search_after">Маршрут после</string>
|
||||
<string name="transport_search_before">Маршрут до</string>
|
||||
<string name="transport_finish_search">Закончить поиск</string>
|
||||
<string name="transport_stop_to_go_out">Выберите остановку</string>
|
||||
<string name="transport_to_go_after">идти после</string>
|
||||
<string name="transport_to_go_before">идти до</string>
|
||||
|
@ -146,7 +147,7 @@
|
|||
<string name="ChooseCountry">Выберите регион</string>
|
||||
<string name="position_on_map_descr">Установить расположение текущей позиции на карте</string>
|
||||
<string name="position_on_map">Текущая позиция</string>
|
||||
<string name="map_specify_point">Перейти к точке</string>
|
||||
<string name="map_specify_point">Координаты</string>
|
||||
<string name="show_view_angle_descr">Показывать угол обзора в соответствии с компасом</string>
|
||||
<string name="show_view_angle">Угол обзора</string>
|
||||
<string name="stop_navigation">Снять отметку</string>
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
<string name="transport_Routes">Routes</string>
|
||||
<string name="transport_Stop">Stop</string>
|
||||
<string name="transport_stops">stops</string>
|
||||
<string name="transport_searching_transport">Searching transport (no target)</string>
|
||||
|
|
|
@ -58,6 +58,7 @@ import com.osmand.Version;
|
|||
import com.osmand.activities.FavouritesActivity.FavouritePoint;
|
||||
import com.osmand.activities.FavouritesActivity.FavouritesDbHelper;
|
||||
import com.osmand.activities.search.SearchActivity;
|
||||
import com.osmand.activities.search.SearchTransportActivity;
|
||||
import com.osmand.data.Amenity;
|
||||
import com.osmand.data.preparation.MapTileDownloader;
|
||||
import com.osmand.data.preparation.MapTileDownloader.DownloadRequest;
|
||||
|
@ -683,6 +684,9 @@ public class MapActivity extends Activity implements LocationListener, IMapLocat
|
|||
Toast.makeText(this, getString(R.string.gps_status_app_not_found), Toast.LENGTH_LONG).show();
|
||||
}
|
||||
return true;
|
||||
} else if (item.getItemId() == R.id.map_transport) {
|
||||
startActivity(new Intent(this, SearchTransportActivity.class));
|
||||
return true;
|
||||
} else if (item.getItemId() == R.id.map_mark_point) {
|
||||
contextMenuPoint(mapView.getLatitude(), mapView.getLongitude(), true);
|
||||
return true;
|
||||
|
|
23
OsmAnd/src/com/osmand/activities/TransportRouteHelper.java
Normal file
23
OsmAnd/src/com/osmand/activities/TransportRouteHelper.java
Normal file
|
@ -0,0 +1,23 @@
|
|||
package com.osmand.activities;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import com.osmand.TransportIndexRepository.RouteInfoLocation;
|
||||
|
||||
public class TransportRouteHelper {
|
||||
private static TransportRouteHelper inst = new TransportRouteHelper();
|
||||
public static TransportRouteHelper getInstance(){
|
||||
return inst;
|
||||
}
|
||||
|
||||
private List<RouteInfoLocation> route = new ArrayList<RouteInfoLocation>();
|
||||
|
||||
public List<RouteInfoLocation> getRoute() {
|
||||
return route;
|
||||
}
|
||||
|
||||
public void setRoute(List<RouteInfoLocation> route) {
|
||||
this.route = route;
|
||||
}
|
||||
}
|
|
@ -30,7 +30,7 @@ public class SearchActivity extends TabActivity {
|
|||
addressSpec = host.newTabSpec("Search_Address").setIndicator(getString(R.string.address)).setContent(new Intent(this, SearchAddressActivity.class));//$NON-NLS-1$
|
||||
host.addTab(addressSpec);
|
||||
host.addTab(host.newTabSpec("Search_Location").setIndicator(getString(R.string.search_tabs_location)).setContent(new Intent(this, NavigatePointActivity.class))); //$NON-NLS-1$
|
||||
host.addTab(host.newTabSpec("Search_Transport").setIndicator(getString(R.string.transport)).setContent(new Intent(this, SearchTransportActivity.class))); //$NON-NLS-1$
|
||||
// host.addTab(host.newTabSpec("Search_Transport").setIndicator(getString(R.string.transport)).setContent(new Intent(this, SearchTransportActivity.class))); //$NON-NLS-1$
|
||||
host.addTab(host.newTabSpec("Search_History").setIndicator(getString(R.string.history)).setContent(new Intent(this, SearchHistoryActivity.class))); //$NON-NLS-1$
|
||||
}
|
||||
|
||||
|
|
|
@ -25,12 +25,14 @@ import android.widget.ListView;
|
|||
import android.widget.ProgressBar;
|
||||
import android.widget.TextView;
|
||||
|
||||
import com.osmand.Algoritms;
|
||||
import com.osmand.Messages;
|
||||
import com.osmand.OsmandSettings;
|
||||
import com.osmand.R;
|
||||
import com.osmand.ResourceManager;
|
||||
import com.osmand.TransportIndexRepository;
|
||||
import com.osmand.TransportIndexRepository.RouteInfoLocation;
|
||||
import com.osmand.activities.TransportRouteHelper;
|
||||
import com.osmand.data.TransportRoute;
|
||||
import com.osmand.data.TransportStop;
|
||||
import com.osmand.osm.LatLon;
|
||||
|
@ -64,7 +66,7 @@ public class SearchTransportActivity extends ListActivity {
|
|||
private TransportRouteAdapter intermediateListAdapater;
|
||||
|
||||
|
||||
private static List<RouteInfoLocation> lastEditedRoute = new ArrayList<RouteInfoLocation>();
|
||||
|
||||
|
||||
@Override
|
||||
public void onCreate(Bundle icicle) {
|
||||
|
@ -88,25 +90,37 @@ public class SearchTransportActivity extends ListActivity {
|
|||
|
||||
|
||||
ListView intermediateList = (ListView) findViewById(R.id.listView);
|
||||
intermediateListAdapater = new TransportRouteAdapter(lastEditedRoute);
|
||||
intermediateListAdapater = new TransportRouteAdapter(TransportRouteHelper.getInstance().getRoute());
|
||||
intermediateList.setAdapter(intermediateListAdapater);
|
||||
intermediateListAdapater.add(null);
|
||||
if(intermediateList.getCount() == 0){
|
||||
intermediateListAdapater.add(null);
|
||||
}
|
||||
|
||||
lastKnownMapLocation = OsmandSettings.getLastKnownMapLocation(this);
|
||||
destinationLocation = OsmandSettings.getPointToNavigate(this);
|
||||
searchTransport();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onDestroy() {
|
||||
super.onDestroy();
|
||||
lastEditedRoute.clear();
|
||||
ArrayList<RouteInfoLocation> lastEditedRoute = new ArrayList<RouteInfoLocation>();
|
||||
for(int i= 0; i< intermediateListAdapater.getCount(); i++){
|
||||
RouteInfoLocation item = intermediateListAdapater.getItem(i);
|
||||
if(item != null){
|
||||
lastEditedRoute.add(item);
|
||||
}
|
||||
}
|
||||
TransportRouteHelper.getInstance().setRoute(lastEditedRoute);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onResume() {
|
||||
super.onResume();
|
||||
if(!Algoritms.objectEquals(OsmandSettings.getLastKnownMapLocation(this), this.lastKnownMapLocation) ||
|
||||
!Algoritms.objectEquals(OsmandSettings.getPointToNavigate(this), this.destinationLocation)){
|
||||
lastKnownMapLocation = OsmandSettings.getLastKnownMapLocation(this);
|
||||
destinationLocation = OsmandSettings.getPointToNavigate(this);
|
||||
searchTransport();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public String getSearchArea(){
|
||||
|
@ -176,7 +190,8 @@ public class SearchTransportActivity extends ListActivity {
|
|||
for (TransportStop s : stops) {
|
||||
if (s == route.getStart()) {
|
||||
stInd = ind;
|
||||
} else if (s == route.getStop()) {
|
||||
}
|
||||
if (s == route.getStop()) {
|
||||
eInd = ind;
|
||||
}
|
||||
if (ind > stInd && ind <= eInd) {
|
||||
|
@ -187,10 +202,17 @@ public class SearchTransportActivity extends ListActivity {
|
|||
text.append(getString(R.string.transport_route_distance)).append(" ").append(MapUtils.getFormattedDistance((int) dist)); //$NON-NLS-1$/
|
||||
if(!part){
|
||||
text.append(", ").append(getString(R.string.transport_stops_to_pass)).append(" ").append(eInd - stInd); //$NON-NLS-1$ //$NON-NLS-2$
|
||||
String before = MapUtils.getFormattedDistance((int) MapUtils.getDistance(getEndStop(position - 1), route.getStart().getLocation()));
|
||||
String after = MapUtils.getFormattedDistance((int) MapUtils.getDistance(getStartStop(position + 1), route.getStop().getLocation()));
|
||||
text.append(", ").append(getString(R.string.transport_to_go_before)).append(" ").append(before).append(", "); //$NON-NLS-2$//$NON-NLS-3$ //$NON-NLS-1$
|
||||
text.append(getString(R.string.transport_to_go_after)).append(" ").append(after); //$NON-NLS-1$
|
||||
LatLon endStop = getEndStop(position - 1);
|
||||
if (endStop != null) {
|
||||
String before = MapUtils.getFormattedDistance((int) MapUtils.getDistance(endStop, route.getStart().getLocation()));
|
||||
text.append(", ").append(getString(R.string.transport_to_go_before)).append(" ").append(before); //$NON-NLS-2$//$NON-NLS-1$
|
||||
}
|
||||
|
||||
LatLon stStop = getStartStop(position + 1);
|
||||
if (stStop != null) {
|
||||
String after = MapUtils.getFormattedDistance((int) MapUtils.getDistance(stStop, route.getStop().getLocation()));
|
||||
text.append(", ").append(getString(R.string.transport_to_go_after)).append(" ").append(after); //$NON-NLS-1$ //$NON-NLS-2$
|
||||
}
|
||||
}
|
||||
|
||||
return text.toString();
|
||||
|
@ -218,9 +240,11 @@ public class SearchTransportActivity extends ListActivity {
|
|||
if(locationToGo != null){
|
||||
n.append(name).append(" - ["); //$NON-NLS-1$
|
||||
n.append(MapUtils.getFormattedDistance((int) MapUtils.getDistance(locationToGo, st.getLocation()))).append("]"); //$NON-NLS-1$
|
||||
} else {
|
||||
} else if(locationToStart != null){
|
||||
n.append("[").append(MapUtils.getFormattedDistance((int) MapUtils.getDistance(locationToStart, st.getLocation()))).append("] - "); //$NON-NLS-1$ //$NON-NLS-2$
|
||||
n.append(name);
|
||||
} else {
|
||||
n.append(name);
|
||||
}
|
||||
items.add(n.toString());
|
||||
}
|
||||
|
@ -270,7 +294,7 @@ public class SearchTransportActivity extends ListActivity {
|
|||
public void showContextMenuOnRoute(final RouteInfoLocation route, final int routeInd) {
|
||||
Builder b = new AlertDialog.Builder(this);
|
||||
List<TransportStop> stops = route.getDirection() ? route.getRoute().getForwardStops() : route.getRoute().getBackwardStops();
|
||||
boolean en = OsmandSettings.isUsingInternetToDownloadTiles(this);
|
||||
boolean en = OsmandSettings.usingEnglishNames(this);
|
||||
|
||||
String info = getInformation(route, stops, routeInd, false);
|
||||
StringBuilder txt = new StringBuilder(300);
|
||||
|
@ -337,7 +361,6 @@ public class SearchTransportActivity extends ListActivity {
|
|||
return getStartStop(getCurrentRouteLocation() + 1);
|
||||
}
|
||||
|
||||
// TODO always check for null
|
||||
public LatLon getStartStop(int position){
|
||||
if(position == intermediateListAdapater.getCount()){
|
||||
return destinationLocation;
|
||||
|
@ -349,8 +372,6 @@ public class SearchTransportActivity extends ListActivity {
|
|||
return item.getStart().getLocation();
|
||||
}
|
||||
|
||||
|
||||
// TODO always check for null
|
||||
public LatLon getEndStop(int position){
|
||||
if(position == -1){
|
||||
return lastKnownMapLocation;
|
||||
|
@ -417,7 +438,8 @@ public class SearchTransportActivity extends ListActivity {
|
|||
} else {
|
||||
icon.setImageResource(R.drawable.closed_poi);
|
||||
}
|
||||
int dist = (int) (MapUtils.getDistance(stop.getStart().getLocation(), locationToStart));
|
||||
|
||||
int dist = locationToStart == null ? 0 : (int) (MapUtils.getDistance(stop.getStart().getLocation(), locationToStart));
|
||||
distanceLabel.setText(" " + MapUtils.getFormattedDistance(dist)); //$NON-NLS-1$
|
||||
|
||||
return (row);
|
||||
|
@ -432,13 +454,13 @@ public class SearchTransportActivity extends ListActivity {
|
|||
|
||||
public View getView(final int position, View convertView, ViewGroup parent) {
|
||||
View row = convertView;
|
||||
int currentRouteLocation = getCurrentRouteLocation();
|
||||
if(position == currentRouteLocation){
|
||||
final RouteInfoLocation info = getItem(position);
|
||||
if(info == null){
|
||||
TextView text = new TextView(getContext());
|
||||
LatLon st = getStartStop(position + 1);
|
||||
LatLon end = getEndStop(position - 1);
|
||||
|
||||
if(st != null){
|
||||
if(st != null && end != null){
|
||||
int dist = (int) MapUtils.getDistance(st, end);
|
||||
text.setText(MessageFormat.format(getString(R.string.transport_searching_route), MapUtils.getFormattedDistance(dist)));
|
||||
} else {
|
||||
|
@ -460,12 +482,12 @@ public class SearchTransportActivity extends ListActivity {
|
|||
});
|
||||
return text;
|
||||
}
|
||||
|
||||
int currentRouteLocation = getCurrentRouteLocation();
|
||||
if (row == null || row instanceof TextView) {
|
||||
LayoutInflater inflater = getLayoutInflater();
|
||||
row = inflater.inflate(R.layout.search_transport_route_item, parent, false);
|
||||
}
|
||||
final RouteInfoLocation info = getItem(position);
|
||||
|
||||
TextView label = (TextView) row.findViewById(R.id.label);
|
||||
ImageButton icon = (ImageButton) row.findViewById(R.id.remove);
|
||||
|
||||
|
@ -482,8 +504,11 @@ public class SearchTransportActivity extends ListActivity {
|
|||
int startDist = (int) MapUtils.getDistance(getEndStop(position - 1), info.getStart().getLocation());
|
||||
labelW.append(getString(R.string.transport_to_go_before)).append(" ").append(MapUtils.getFormattedDistance(startDist)); //$NON-NLS-1$
|
||||
if (position == getCount() - 1) {
|
||||
int endDist = (int) MapUtils.getDistance(getStartStop(position + 1), info.getStop().getLocation());
|
||||
labelW.append(", ").append(getString(R.string.transport_to_go_after)).append(" ").append(MapUtils.getFormattedDistance(endDist)); //$NON-NLS-1$ //$NON-NLS-2$
|
||||
LatLon stop = getStartStop(position + 1);
|
||||
if(stop != null) {
|
||||
int endDist = (int) MapUtils.getDistance(stop, info.getStop().getLocation());
|
||||
labelW.append(", ").append(getString(R.string.transport_to_go_after)).append(" ").append(MapUtils.getFormattedDistance(endDist)); //$NON-NLS-1$ //$NON-NLS-2$
|
||||
}
|
||||
}
|
||||
|
||||
labelW.append(")"); //$NON-NLS-1$
|
||||
|
|
|
@ -13,6 +13,7 @@ import android.graphics.RectF;
|
|||
import android.widget.Toast;
|
||||
|
||||
import com.osmand.OsmandSettings;
|
||||
import com.osmand.R;
|
||||
import com.osmand.ResourceManager;
|
||||
import com.osmand.TransportIndexRepository;
|
||||
import com.osmand.activities.search.SearchTransportActivity;
|
||||
|
@ -76,8 +77,8 @@ public class TransportStopsLayer implements OsmandMapLayer {
|
|||
TransportStop n = getFromPoint(point);
|
||||
if(n != null){
|
||||
StringBuilder text = new StringBuilder(250);
|
||||
text.append("Stop").append(" : ").append(n.getName(OsmandSettings.usingEnglishNames(view.getContext()))); //$NON-NLS-2$
|
||||
text.append("\n").append("Routes").append(" : "); //$NON-NLS-1$//$NON-NLS-3$
|
||||
text.append(view.getContext().getString(R.string.transport_Stop)).append(" : ").append(n.getName(OsmandSettings.usingEnglishNames(view.getContext()))); //$NON-NLS-1$
|
||||
text.append("\n").append(view.getContext().getString(R.string.transport_Routes)).append(" : "); //$NON-NLS-1$ //$NON-NLS-2$
|
||||
List<TransportIndexRepository> reps = ResourceManager.getResourceManager().searchTransportRepositories(n.getLocation().getLatitude(), n.getLocation().getLongitude());
|
||||
if(!reps.isEmpty()){
|
||||
List<String> l;
|
||||
|
|
Loading…
Reference in a new issue