git-svn-id: https://osmand.googlecode.com/svn/trunk@360 e29c36b1-1cfa-d876-8d93-3434fc2bb7b8
This commit is contained in:
Victor Shcherb 2010-07-17 20:25:35 +00:00
parent e37a7c3948
commit 9733788ca1
9 changed files with 55 additions and 34 deletions

View file

@ -11,20 +11,24 @@ public class ToDoConstants {
// TODO ANDROID
// for 0.3
// 68. Implement service to app work with screen offline
// (audio guidance & add new item to status bar & introduce error interval for building)
// (audio guidance & add new item to status bar & introduce error interval for gps building)
// for offline service save gpx (combine in one trkseg)
// 71. Implement different mechanism for tiles (see rmaps)
// 71. Implement different mechanism for tiles (big sqlite planet see rmaps)
// Improvement : Show stops in the transport route on the map
// Improvement : show favorites on the map?
// Improvement : hard to press on the POI/....
// Improvement : show detailed route on the map with turns and show route information directly (like in gmaps)
// Improvement : redesign poi selecting (show on map )
// Improvement : progress while loading tiles
// Improvement : download with wget
// Improvement : cloudmade as map?
// Yandex traffic : http://jgo.maps.yandex.net/tiles?l=trf
// BUG add button show my location
// FIXME
// 1. Bug with duplicated turns
// 2. Bug with network location while routing (?)
// 3. TODO options : using trackball as an option
// Not clear if it is really needed

View file

@ -2,13 +2,14 @@
<menu
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/mark_point" android:id="@+id/map_mark_point" android:icon="@android:drawable/ic_menu_edit"></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:title="@string/where_am_i" android:id="@+id/map_where_am_i" android:icon="@android:drawable/ic_menu_mylocation"></item>
<item android:id="@+id/map_mute" android:title="@string/menu_mute_off" android:visible="false"></item>
<item android:id="@+id/map_get_directions" android:title="@string/get_directions" android:icon="@android:drawable/ic_menu_directions"></item>
<item android:id="@+id/map_show_settings" android:title="@string/settings_Button" android:icon="@android:drawable/ic_menu_preferences"></item>
<item android:id="@+id/map_transport" android:title="@string/transport"></item>
<item android:id="@+id/map_transport" android:title="@string/transport"></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>

View file

@ -1,5 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="where_am_i">Где я?</string>
<string name="network_provider">Сеть</string>
<string name="gps_provider">GPS</string>
<string name="int_min">мин.</string>

View file

@ -1,5 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="where_am_i">Where am I?</string>
<string name="process_navigation_service">Osmand navigation service</string>
<string name="network_provider">Network</string>
<string name="gps_provider">GPS</string>

View file

@ -57,7 +57,8 @@ public class ResourceManager {
}
// it is not good investigated but no more than 64 (satellite images)
protected final int maxImgCacheSize = 64;
// Only 8 MB (from 16 Mb whole mem) available for images : image 64K * 128 = 8 MB (8 bit), 64 - 16 bit, 32 - 128 bit
protected final int maxImgCacheSize = 48;
protected Map<String, Bitmap> cacheOfImages = new LinkedHashMap<String, Bitmap>();
protected Map<String, Boolean> imagesOnFS = new LinkedHashMap<String, Boolean>() ;
@ -105,6 +106,8 @@ public class ResourceManager {
}
} else if(f.getName().endsWith(".tile")){ //$NON-NLS-1$
imagesOnFS.put(prefix + f.getName(), Boolean.TRUE);
} else if(f.getName().endsWith(".sqlitedb")){ //$NON-NLS-1$
// TODO
}
}
@ -211,7 +214,7 @@ public class ResourceManager {
long time = System.currentTimeMillis();
cacheOfImages.put(req.fileToLoad, BitmapFactory.decodeFile(en.getAbsolutePath()));
if (log.isDebugEnabled()) {
log.debug("Loaded file : " + req.fileToLoad + " " + -(time - System.currentTimeMillis()) + " ms"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
log.debug("Loaded file : " + req.fileToLoad + " " + -(time - System.currentTimeMillis()) + " ms " + cacheOfImages.size()); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
}
}
@ -442,6 +445,7 @@ public class ResourceManager {
protected void clearTiles(){
log.info("Cleaning tiles - size = " + cacheOfImages.size()); //$NON-NLS-1$
ArrayList<String> list = new ArrayList<String>(cacheOfImages.keySet());
// remove first images (as we think they are older)
for (int i = 0; i < list.size()/2; i ++) {

View file

@ -256,18 +256,7 @@ public class MapActivity extends Activity implements IMapLocationListener, Senso
backToLocation.setOnClickListener(new OnClickListener(){
@Override
public void onClick(View v) {
backToLocation.setVisibility(View.INVISIBLE);
if(!isMapLinkedToLocation()){
OsmandSettings.setSyncMapToGpsLocation(MapActivity.this, true);
if(locationLayer.getLastKnownLocation() != null){
Location lastKnownLocation = locationLayer.getLastKnownLocation();
AnimateDraggingMapThread thread = mapView.getAnimatedDraggingThread();
int fZoom = mapView.getZoom() < 15 ? 15 : mapView.getZoom();
thread.startMoving(mapView.getLatitude(), mapView.getLongitude(),
lastKnownLocation.getLatitude(), lastKnownLocation.getLongitude(), mapView.getZoom(), fZoom,
mapView.getSourceTileSize(), mapView.getRotate(), false);
}
}
backToLocationImpl();
}
});
@ -533,7 +522,9 @@ public class MapActivity extends Activity implements IMapLocationListener, Senso
if(LocationProvider.OUT_OF_SERVICE == status){
setLocation(null);
}
if (!isRunningOnEmulator() && service.isProviderEnabled(LocationManager.NETWORK_PROVIDER)) {
// do not use it in routing
if (!isRunningOnEmulator() && !routingHelper.isFollowingMode() &&
service.isProviderEnabled(LocationManager.NETWORK_PROVIDER)) {
if (!Algoritms.objectEquals(currentLocationProvider, LocationManager.NETWORK_PROVIDER)) {
currentLocationProvider = LocationManager.NETWORK_PROVIDER;
service.requestLocationUpdates(LocationManager.NETWORK_PROVIDER, GPS_TIMEOUT_REQUEST, GPS_DIST_REQUEST, this);
@ -775,6 +766,9 @@ public class MapActivity extends Activity implements IMapLocationListener, Senso
final Intent settings = new Intent(MapActivity.this, SettingsActivity.class);
startActivity(settings);
return true;
} else if (item.getItemId() == R.id.map_where_am_i) {
backToLocationImpl();
return true;
} else if (item.getItemId() == R.id.map_show_gps_status) {
Intent intent = new Intent();
intent.setComponent(new ComponentName(GPS_STATUS_COMPONENT, GPS_STATUS_ACTIVITY));
@ -1054,5 +1048,20 @@ public class MapActivity extends Activity implements IMapLocationListener, Senso
public void onAccuracyChanged(Sensor sensor, int accuracy) {
}
protected void backToLocationImpl() {
backToLocation.setVisibility(View.INVISIBLE);
if(!isMapLinkedToLocation()){
OsmandSettings.setSyncMapToGpsLocation(MapActivity.this, true);
if(locationLayer.getLastKnownLocation() != null){
Location lastKnownLocation = locationLayer.getLastKnownLocation();
AnimateDraggingMapThread thread = mapView.getAnimatedDraggingThread();
int fZoom = mapView.getZoom() < 15 ? 15 : mapView.getZoom();
thread.startMoving(mapView.getLatitude(), mapView.getLongitude(),
lastKnownLocation.getLatitude(), lastKnownLocation.getLongitude(), mapView.getZoom(), fZoom,
mapView.getSourceTileSize(), mapView.getRotate(), false);
}
}
}
}

View file

@ -87,17 +87,18 @@ public class RouteProvider {
if (locations.get(0).distanceTo(start) > 200) {
// add start point
locations.add(0, start);
}
if (directions != null) {
for (RouteDirectionInfo i : directions) {
i.routePointOffset++;
if (directions != null) {
for (RouteDirectionInfo i : directions) {
i.routePointOffset++;
}
RouteDirectionInfo info = new RouteDirectionInfo();
info.turnType = TurnType.valueOf(TurnType.C);
info.routePointOffset = 0;
info.descriptionRoute = "" ;//getString(ctx, R.string.route_head); //$NON-NLS-1$
directions.add(0, info);
}
RouteDirectionInfo info = new RouteDirectionInfo();
info.turnType = TurnType.valueOf(TurnType.C);
info.routePointOffset = 0;
info.descriptionRoute = "" ;//getString(ctx, R.string.route_head); //$NON-NLS-1$
directions.add(0, info);
}
// check points for duplicates (it is very bad for routing) - cloudmade could return it
for (int i = 0; i < locations.size() - 1; ) {
if(locations.get(i).distanceTo(locations.get(i+1)) == 0){
@ -198,7 +199,6 @@ public class RouteProvider {
minDistanceForTurn = 12;
}
// add start point if needed
List<RouteDirectionInfo> directions = new ArrayList<RouteDirectionInfo>();

View file

@ -119,8 +119,9 @@ public class VoiceRouter {
play.roundAbout(next.turnType.getTurnAngle(), next.turnType.getExitOut());
} else if(next.turnType.getValue().equals(TurnType.TU)){
play.makeUT();
} else if(next.turnType.getValue().equals(TurnType.C)){
play.goAhead();
// do not say it
// } else if(next.turnType.getValue().equals(TurnType.C)){
// play.goAhead();
} else {
isplay = false;
}

View file

@ -43,7 +43,7 @@ bear_left == ['bear_left.ogg'].
route_recalc(_Dist) == ['recalc.ogg'].
go_ahead(Dist) == ['Drive.ogg', delay_250, D]:- distance(Dist) == D.
go_ahead == ['continue.ogg'].
go_ahead == ['continue.ogg', 'stright.ogg'].
%%
nth(1, '1st.ogg').