improve transport stops
git-svn-id: https://osmand.googlecode.com/svn/trunk@273 e29c36b1-1cfa-d876-8d93-3434fc2bb7b8
This commit is contained in:
parent
0fc3d6b70a
commit
3e347ca025
9 changed files with 48 additions and 5 deletions
|
@ -29,6 +29,7 @@ public class ToDoConstants {
|
|||
// IDEA TO HAVE :
|
||||
|
||||
|
||||
// 66. Transport routing (show next stop, total distance, show stop get out).
|
||||
// 43. Enable poi filter by name
|
||||
// 58. Upload/Download zip-index from site & unzip them on phone
|
||||
// 45. Get clear <Use internet> settings. Move that setting on top settings screen.
|
||||
|
|
|
@ -7,5 +7,8 @@ public class TransportStop extends MapObject {
|
|||
public TransportStop(Entity e){
|
||||
super(e);
|
||||
}
|
||||
|
||||
public TransportStop(){
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -22,6 +22,7 @@ public class IndexBatchCreator {
|
|||
// config params
|
||||
private static final boolean indexPOI = true;
|
||||
private static final boolean indexAddress = false;
|
||||
private static final boolean indexTransport = true;
|
||||
private static final boolean writeWayNodes = true;
|
||||
|
||||
protected static final Log log = LogUtil.getLog(IndexBatchCreator.class);
|
||||
|
@ -152,7 +153,7 @@ public class IndexBatchCreator {
|
|||
System.out.println("GENERATING INDEXES FINISHED ");
|
||||
}
|
||||
protected void generateIndex(File f){
|
||||
DataExtraction extr = new DataExtraction(indexAddress, indexPOI, false, true, false, false, indexDirFiles);
|
||||
DataExtraction extr = new DataExtraction(indexAddress, indexPOI, indexTransport, indexAddress, false, false, indexDirFiles);
|
||||
try {
|
||||
Region country = extr.readCountry(f.getAbsolutePath(), new ConsoleProgressImplementation(9), null);
|
||||
DataIndexWriter dataIndexWriter = new DataIndexWriter(indexDirFiles, country);
|
||||
|
@ -163,6 +164,9 @@ public class IndexBatchCreator {
|
|||
if(indexPOI){
|
||||
dataIndexWriter.writePOI(name + "_" + IndexConstants.POI_TABLE_VERSION + IndexConstants.POI_INDEX_EXT, f.lastModified());
|
||||
}
|
||||
if(indexTransport){
|
||||
dataIndexWriter.writeTransport(name + "_" + IndexConstants.TRANSPORT_TABLE_VERSION + IndexConstants.TRANSPORT_INDEX_EXT, f.lastModified());
|
||||
}
|
||||
} catch (Exception e) {
|
||||
log.error("Exception generating indexes for " + f.getName()); //$NON-NLS-1$
|
||||
}
|
||||
|
@ -191,7 +195,10 @@ public class IndexBatchCreator {
|
|||
summary = "POI index for " + regionName + " " + descriptionFile;
|
||||
} else if(f.getName().endsWith(IndexConstants.ADDRESS_INDEX_EXT)){
|
||||
String regionName = f.getName().substring(0, f.getName().length() - IndexConstants.ADDRESS_INDEX_EXT.length() - 2);
|
||||
summary = "Adress index for " + regionName + " " + descriptionFile;
|
||||
summary = "Adress index for " + regionName + " " + descriptionFile;
|
||||
} else if(f.getName().endsWith(IndexConstants.TRANSPORT_INDEX_EXT)){
|
||||
String regionName = f.getName().substring(0, f.getName().length() - IndexConstants.TRANSPORT_INDEX_EXT.length() - 2);
|
||||
summary = "Transport index for " + regionName + " " + descriptionFile;
|
||||
} else {
|
||||
continue;
|
||||
}
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
<string name="show_transport_over_map_description">Показать остановки транспорта на карте</string>
|
||||
<string name="show_transport_over_map">Показать транспорт</string>
|
||||
<string name="hello">Навигационное приложение OsmAnd</string>
|
||||
<string name="update_poi_success">Данные POI были успешно обновлены ({0} объектов загружено)</string>
|
||||
<string name="update_poi_error_local">Ошибка сохранения POI в локальный индекс</string>
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
<string name="show_transport_over_map_description">Show public transport stops on map</string>
|
||||
<string name="show_transport_over_map">Show transport stops</string>
|
||||
<string name="hello">Navigation application OsmAnd</string>
|
||||
<string name="update_poi_success">POI data was updated successfully ({0} were loaded)</string>
|
||||
<string name="update_poi_error_local">Error updating local indexes</string>
|
||||
|
|
|
@ -9,6 +9,7 @@
|
|||
<ListPreference android:title="@string/map_tile_source" android:summary="@string/map_tile_source_descr" android:key="map_tile_sources"></ListPreference>
|
||||
<ListPreference android:title="@string/max_level_download_tile" android:summary="@string/max_level_download_tile_descr" android:key="max_level_download_tile"></ListPreference>
|
||||
<CheckBoxPreference android:key="show_poi_over_map" android:title="@string/show_poi_over_map" android:summary="@string/show_poi_over_map_description"></CheckBoxPreference>
|
||||
<CheckBoxPreference android:key="show_transport_over_map" android:title="@string/show_transport_over_map" android:summary="@string/show_transport_over_map_description"></CheckBoxPreference>
|
||||
<CheckBoxPreference android:title="@string/auto_zoom_map" android:summary="@string/auto_zoom_map_descr" android:key="auto_zoom_map"></CheckBoxPreference>
|
||||
<CheckBoxPreference android:key="show_view_angle" android:title="@string/show_view_angle" android:summary="@string/show_view_angle_descr"></CheckBoxPreference>
|
||||
<CheckBoxPreference android:key="rotate_map_to_bearing" android:title="@string/rotate_map_to_bearing" android:summary="@string/rotate_map_to_bearing_descr"></CheckBoxPreference>
|
||||
|
|
|
@ -63,6 +63,19 @@ public class OsmandSettings {
|
|||
SharedPreferences prefs = ctx.getSharedPreferences(SHARED_PREFERENCES_NAME, Context.MODE_WORLD_READABLE);
|
||||
return prefs.edit().putBoolean(SHOW_POI_OVER_MAP, val).commit();
|
||||
}
|
||||
|
||||
// this value string is synchronized with settings_pref.xml preference name
|
||||
public static final String SHOW_TRANSPORT_OVER_MAP = "show_transport_over_map"; //$NON-NLS-1$
|
||||
|
||||
public static boolean isShowingTransportOverMap(Context ctx) {
|
||||
SharedPreferences prefs = ctx.getSharedPreferences(SHARED_PREFERENCES_NAME, Context.MODE_WORLD_READABLE);
|
||||
return prefs.getBoolean(SHOW_TRANSPORT_OVER_MAP, false);
|
||||
}
|
||||
|
||||
public static boolean setShowTransortOverMap(Context ctx, boolean val) {
|
||||
SharedPreferences prefs = ctx.getSharedPreferences(SHARED_PREFERENCES_NAME, Context.MODE_WORLD_READABLE);
|
||||
return prefs.edit().putBoolean(SHOW_TRANSPORT_OVER_MAP, val).commit();
|
||||
}
|
||||
|
||||
// this value string is synchronized with settings_pref.xml preference name
|
||||
public static final String USER_NAME = "user_name"; //$NON-NLS-1$
|
||||
|
|
|
@ -174,9 +174,8 @@ public class MapActivity extends Activity implements LocationListener, IMapLocat
|
|||
osmBugsLayer = new OsmBugsLayer(this);
|
||||
// 3. poi layer
|
||||
poiMapLayer = new POIMapLayer();
|
||||
// 4. poi layer
|
||||
// 4. transport layer
|
||||
transportStopsLayer = new TransportStopsLayer();
|
||||
mapView.addLayer(transportStopsLayer);
|
||||
// 5. point navigation layer
|
||||
navigationLayer = new PointNavigationLayer();
|
||||
mapView.addLayer(navigationLayer);
|
||||
|
@ -353,7 +352,8 @@ public class MapActivity extends Activity implements LocationListener, IMapLocat
|
|||
}
|
||||
|
||||
private void updateSpeedBearing(Location location) {
|
||||
// For gps it's bad way. It's widely used for testing purposes
|
||||
// For network/gps it's bad way (not accurate). It's widely used for testing purposes
|
||||
// possibly keep using only for emulator case
|
||||
if (!providerSupportsSpeed && locationLayer.getLastKnownLocation() != null && location != null) {
|
||||
if (locationLayer.getLastKnownLocation().distanceTo(location) > 3) {
|
||||
float d = location.distanceTo(locationLayer.getLastKnownLocation());
|
||||
|
@ -561,6 +561,13 @@ public class MapActivity extends Activity implements LocationListener, IMapLocat
|
|||
backToLocation.setVisibility(View.INVISIBLE);
|
||||
|
||||
|
||||
if(mapView.getLayers().contains(transportStopsLayer) != OsmandSettings.isShowingTransportOverMap(this)){
|
||||
if(OsmandSettings.isShowingTransportOverMap(this)){
|
||||
mapView.addLayer(transportStopsLayer, routeLayer);
|
||||
} else {
|
||||
mapView.removeLayer(transportStopsLayer);
|
||||
}
|
||||
}
|
||||
|
||||
if(mapView.getLayers().contains(poiMapLayer) != OsmandSettings.isShowingPoiOverMap(this)){
|
||||
if(OsmandSettings.isShowingPoiOverMap(this)){
|
||||
|
|
|
@ -50,6 +50,7 @@ public class SettingsActivity extends PreferenceActivity implements OnPreference
|
|||
private Preference downloadIndexes;
|
||||
private ListPreference routerPreference;
|
||||
private ListPreference maxLevelToDownload;
|
||||
private CheckBoxPreference showTransport;
|
||||
|
||||
@Override
|
||||
public void onCreate(Bundle savedInstanceState) {
|
||||
|
@ -72,6 +73,8 @@ public class SettingsActivity extends PreferenceActivity implements OnPreference
|
|||
autoZoom.setOnPreferenceChangeListener(this);
|
||||
showOsmBugs =(CheckBoxPreference) screen.findPreference(OsmandSettings.SHOW_OSM_BUGS);
|
||||
showOsmBugs.setOnPreferenceChangeListener(this);
|
||||
showTransport =(CheckBoxPreference) screen.findPreference(OsmandSettings.SHOW_TRANSPORT_OVER_MAP);
|
||||
showTransport.setOnPreferenceChangeListener(this);
|
||||
|
||||
useEnglishNames =(CheckBoxPreference) screen.findPreference(OsmandSettings.USE_ENGLISH_NAMES);
|
||||
useEnglishNames.setOnPreferenceChangeListener(this);
|
||||
|
@ -116,6 +119,7 @@ public class SettingsActivity extends PreferenceActivity implements OnPreference
|
|||
rotateMapToBearing.setChecked(OsmandSettings.isRotateMapToBearing(this));
|
||||
showViewAngle.setChecked(OsmandSettings.isShowingViewAngle(this));
|
||||
showOsmBugs.setChecked(OsmandSettings.isShowingOsmBugs(this));
|
||||
showTransport.setChecked(OsmandSettings.isShowingTransportOverMap(this));
|
||||
saveTrackToGpx.setChecked(OsmandSettings.isSavingTrackToGpx(this));
|
||||
useEnglishNames.setChecked(OsmandSettings.usingEnglishNames(this));
|
||||
autoZoom.setChecked(OsmandSettings.isAutoZoomEnabled(this));
|
||||
|
@ -201,6 +205,9 @@ public class SettingsActivity extends PreferenceActivity implements OnPreference
|
|||
} else if(preference == autoZoom){
|
||||
edit.putBoolean(OsmandSettings.AUTO_ZOOM_MAP, (Boolean) newValue);
|
||||
edit.commit();
|
||||
} else if(preference == showTransport){
|
||||
edit.putBoolean(OsmandSettings.SHOW_TRANSPORT_OVER_MAP, (Boolean) newValue);
|
||||
edit.commit();
|
||||
} else if(preference == showPoiOnMap){
|
||||
edit.putBoolean(OsmandSettings.SHOW_POI_OVER_MAP, (Boolean) newValue);
|
||||
if((Boolean)newValue){
|
||||
|
|
Loading…
Reference in a new issue