fix search near last map location
git-svn-id: https://osmand.googlecode.com/svn/trunk@465 e29c36b1-1cfa-d876-8d93-3434fc2bb7b8
This commit is contained in:
parent
73449e4ea6
commit
a91bbba9c9
4 changed files with 73 additions and 36 deletions
|
@ -1,9 +1,5 @@
|
|||
package net.osmand;
|
||||
|
||||
import java.io.File;
|
||||
import java.sql.SQLException;
|
||||
|
||||
import net.osmand.data.preparation.IndexCreator;
|
||||
|
||||
|
||||
/**
|
||||
|
@ -16,7 +12,6 @@ public class ToDoConstants {
|
|||
// Current result : for big file (1 - task 60-80% time, 90% memory) (?) (+)
|
||||
// 11. Index buildings using interpolations (from nodes) (+)
|
||||
// ! 12. Reinvent UI of swing app (remove Region object and clear other MapObject) use indexes to show results
|
||||
// 13. Automative to index way nodes or not.
|
||||
|
||||
// TODO max 86
|
||||
// ! 81. Add some objects to POI category (1) to add them into OSM 2) to help navigation)
|
||||
|
@ -24,19 +19,18 @@ public class ToDoConstants {
|
|||
// railway( station, subway?) - issue 17
|
||||
|
||||
// TODO check network availability
|
||||
// TODO in IndexCreator and other files!
|
||||
// TODO's in IndexCreator and other files!
|
||||
|
||||
|
||||
// TODO BUGS:
|
||||
// USA indexes
|
||||
// ! VELCOM - competition (ppt)
|
||||
// ! search poi without gps !
|
||||
|
||||
// rotate map gps without location
|
||||
// recalculating route when location is far from !
|
||||
// ----- from site ---
|
||||
// - 5 (?)
|
||||
// - menu order (41)
|
||||
// - landscape view not reachable (39)
|
||||
// - 81. (17)
|
||||
// -- house tagging (31)
|
||||
// --- go back to osmand (23)
|
||||
|
@ -44,10 +38,9 @@ public class ToDoConstants {
|
|||
// --- add poi tags (44)
|
||||
|
||||
|
||||
// PRESENTS : mediamarkt, parfum, coffee, (al?), (om?), olia?
|
||||
// PRESENTS : mediamarkt, parfum, coffee, (al-parfum), (om?), olia?
|
||||
|
||||
|
||||
|
||||
// Unscheduled (complex)
|
||||
// 65. Intermediate points - for better control routing, to avoid traffic jams ...(?)
|
||||
// 40. Support simple vector road rendering (require new index file) (?)
|
||||
|
@ -64,7 +57,6 @@ public class ToDoConstants {
|
|||
// 85. Enable on/off screen for bike navigation (?)
|
||||
// 83. Add monitoring service to send locations to internet (?)
|
||||
|
||||
|
||||
// DONE ANDROID :
|
||||
// 82. Rotate map according compass
|
||||
// 85. Remove context menu on long press map ! Accumulate actions and show label (+)
|
||||
|
@ -73,14 +65,14 @@ public class ToDoConstants {
|
|||
// 10. Improve address indexing (use relations). (+)
|
||||
// use relation "a6" (to accumulate streets!), "a3" to read all cities & define boundaries for city (& define that street in city).
|
||||
|
||||
public static void main(String[] args) throws SQLException, ClassNotFoundException {
|
||||
File dir = new File("e:\\Information\\OSM maps\\osm_batch_ind\\");
|
||||
Class.forName("org.sqlite.JDBC");
|
||||
for(File f : dir.listFiles()){
|
||||
if(f.getName().endsWith(".odb")){
|
||||
IndexCreator.removeWayNodes(f);
|
||||
}
|
||||
}
|
||||
}
|
||||
// public static void main(String[] args) throws SQLException, ClassNotFoundException {
|
||||
// File dir = new File("e:\\Information\\OSM maps\\osm_map\\!big!\\");
|
||||
// Class.forName("org.sqlite.JDBC");
|
||||
// for(File f : dir.listFiles()){
|
||||
// if(f.getName().endsWith(".odb")){
|
||||
// IndexCreator.removeWayNodes(f);
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
|
||||
}
|
||||
|
|
|
@ -83,7 +83,7 @@
|
|||
<string name="first_time_msg">Спасибо за то, что выбрали OsmAnd. \n
|
||||
Для полноценного использования приложения вам потребуются файлы индексы, которые необходимо загрузить (Настройки/Данные) или подготовить. После загрузки вам будет доступен : поиск по адресу, поиск POI, поиск транспорта.</string>
|
||||
<string name="search_poi_location">Поиск сигнала...</string>
|
||||
<string name="search_near_map">Искать возле видимой карты</string>
|
||||
<string name="search_near_map">Искать вокруг выбранного центра карты</string>
|
||||
<string name="search_nearby">Искать рядом</string>
|
||||
<string name="map_orientation_default">По умолчанию</string>
|
||||
<string name="map_orientation_portrait">Портрет</string>
|
||||
|
|
|
@ -8,12 +8,14 @@ import java.util.ArrayList;
|
|||
import java.util.LinkedHashSet;
|
||||
import java.util.List;
|
||||
|
||||
import net.osmand.OsmandSettings;
|
||||
import net.osmand.PoiFilter;
|
||||
import net.osmand.PoiFiltersHelper;
|
||||
import net.osmand.R;
|
||||
import net.osmand.PoiFiltersHelper.PoiFilterDbHelper;
|
||||
import net.osmand.activities.search.SearchPOIActivity;
|
||||
import net.osmand.data.AmenityType;
|
||||
import net.osmand.osm.LatLon;
|
||||
import android.app.AlertDialog;
|
||||
import android.app.ListActivity;
|
||||
import android.app.AlertDialog.Builder;
|
||||
|
@ -60,13 +62,38 @@ public class EditPOIFilterActivity extends ListActivity {
|
|||
@Override
|
||||
public void onClick(View v) {
|
||||
Bundle extras = getIntent().getExtras();
|
||||
Intent newIntent = new Intent(EditPOIFilterActivity.this, SearchPOIActivity.class);
|
||||
newIntent.putExtra(SearchPOIActivity.AMENITY_FILTER, filter.getFilterId());
|
||||
boolean searchNearBy = true;
|
||||
LatLon lastKnownMapLocation = OsmandSettings.getLastKnownMapLocation(EditPOIFilterActivity.this);
|
||||
double latitude = lastKnownMapLocation != null ? lastKnownMapLocation.getLatitude() : 0;
|
||||
double longitude = lastKnownMapLocation != null ? lastKnownMapLocation.getLongitude() : 0;
|
||||
final Intent newIntent = new Intent(EditPOIFilterActivity.this, SearchPOIActivity.class);
|
||||
if(extras != null && extras.containsKey(SEARCH_LAT) && extras.containsKey(SEARCH_LON)){
|
||||
newIntent.putExtra(SearchPOIActivity.SEARCH_LAT, extras.getDouble(SEARCH_LAT));
|
||||
newIntent.putExtra(SearchPOIActivity.SEARCH_LON, extras.getDouble(SEARCH_LON));
|
||||
latitude = extras.getDouble(SEARCH_LAT);
|
||||
longitude = extras.getDouble(SEARCH_LON);
|
||||
searchNearBy = false;
|
||||
}
|
||||
final double lat = latitude;
|
||||
final double lon = longitude;
|
||||
newIntent.putExtra(SearchPOIActivity.AMENITY_FILTER, filter.getFilterId());
|
||||
if (searchNearBy) {
|
||||
AlertDialog.Builder b = new AlertDialog.Builder(EditPOIFilterActivity.this);
|
||||
b.setItems(new String[] { getString(R.string.search_nearby), getString(R.string.search_near_map) },
|
||||
new DialogInterface.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(DialogInterface dialog, int which) {
|
||||
if (which == 1) {
|
||||
newIntent.putExtra(SearchPOIActivity.SEARCH_LAT, lat);
|
||||
newIntent.putExtra(SearchPOIActivity.SEARCH_LON, lon);
|
||||
}
|
||||
startActivity(newIntent);
|
||||
}
|
||||
});
|
||||
b.show();
|
||||
} else {
|
||||
newIntent.putExtra(SearchPOIActivity.SEARCH_LAT, lat);
|
||||
newIntent.putExtra(SearchPOIActivity.SEARCH_LON, lon);
|
||||
startActivity(newIntent);
|
||||
}
|
||||
startActivity(newIntent);
|
||||
}
|
||||
});
|
||||
|
||||
|
|
|
@ -7,11 +7,15 @@ import java.util.ArrayList;
|
|||
import java.util.List;
|
||||
|
||||
import net.osmand.NameFinderPoiFilter;
|
||||
import net.osmand.OsmandSettings;
|
||||
import net.osmand.PoiFilter;
|
||||
import net.osmand.PoiFiltersHelper;
|
||||
import net.osmand.R;
|
||||
import net.osmand.activities.EditPOIFilterActivity;
|
||||
import net.osmand.osm.LatLon;
|
||||
import android.app.AlertDialog;
|
||||
import android.app.ListActivity;
|
||||
import android.content.DialogInterface;
|
||||
import android.content.Intent;
|
||||
import android.graphics.Typeface;
|
||||
import android.os.Bundle;
|
||||
|
@ -50,6 +54,10 @@ public class SearchPoiFilterActivity extends ListActivity {
|
|||
searchNearBy = false;
|
||||
latitude = extras.getDouble(SEARCH_LAT);
|
||||
longitude = extras.getDouble(SEARCH_LON);
|
||||
} else {
|
||||
LatLon loc = OsmandSettings.getLastKnownMapLocation(this);
|
||||
latitude = loc.getLatitude();
|
||||
longitude = loc.getLongitude();
|
||||
}
|
||||
|
||||
typeFace = Typeface.create((String)null, Typeface.ITALIC);
|
||||
|
@ -94,20 +102,30 @@ public class SearchPoiFilterActivity extends ListActivity {
|
|||
showEditActivity(filter);
|
||||
return;
|
||||
}
|
||||
// AlertDialog.Builder b = new AlertDialog.Builder(this);
|
||||
// b.setItems(new String[]{getString(R.string.search_nearby), getString(R.string.search_near_map)}, new DialogInterface.OnClickListener(){
|
||||
// @Override
|
||||
// public void onClick(DialogInterface dialog, int which) {
|
||||
// }
|
||||
// });
|
||||
// b.show();
|
||||
Intent newIntent = new Intent(SearchPoiFilterActivity.this, SearchPOIActivity.class);
|
||||
final Intent newIntent = new Intent(SearchPoiFilterActivity.this, SearchPOIActivity.class);
|
||||
newIntent.putExtra(SearchPOIActivity.AMENITY_FILTER, filter.getFilterId());
|
||||
if(!searchNearBy){
|
||||
if (searchNearBy) {
|
||||
AlertDialog.Builder b = new AlertDialog.Builder(this);
|
||||
b.setItems(new String[] { getString(R.string.search_nearby), getString(R.string.search_near_map) },
|
||||
new DialogInterface.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(DialogInterface dialog, int which) {
|
||||
if (which == 1) {
|
||||
newIntent.putExtra(SearchPOIActivity.SEARCH_LAT, latitude);
|
||||
newIntent.putExtra(SearchPOIActivity.SEARCH_LON, longitude);
|
||||
}
|
||||
startActivityForResult(newIntent, 0);
|
||||
}
|
||||
});
|
||||
b.show();
|
||||
} else {
|
||||
newIntent.putExtra(SearchPOIActivity.SEARCH_LAT, latitude);
|
||||
newIntent.putExtra(SearchPOIActivity.SEARCH_LON, longitude);
|
||||
startActivityForResult(newIntent, 0);
|
||||
}
|
||||
startActivityForResult(newIntent, 0);
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Reference in a new issue