Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also compare across forks.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also compare across forks.
base fork: phyrex1an/PathPal
base: 1c3c76cbe1
...
head fork: phyrex1an/PathPal
compare: 26868cb01d
  • 4 commits
  • 2 files changed
  • 0 commit comments
  • 1 contributor
Commits on May 05, 2011
Adam Bengtsson as 8133d5f
Adam Bengtsson Merge branch 'refs/heads/master' of
https://kanalj@github.com/phyrex1an/PathPal.git
2d7a645
Adam Bengtsson Changed limits in DirectionForm.findLocation 61ae21d
Adam Bengtsson Tried out the new cool DirectonForm 26868cb
View
2  src/org/pathpal/DirectionsForm.java
@@ -22,7 +22,7 @@
}
public Address findLocation(SearchApi api) throws IOException {
- return api.geocoder.getFromLocationName(name, 0).remove(0);
+ return api.geocoder.getFromLocationName(name, 1).remove(0);
}
}
View
66 src/org/pathpal/GMapsActivity.java
@@ -67,9 +67,16 @@ public void onCreate(Bundle savedInstanceState) {
GeoPoint gp_end = new GeoPoint(38036160, 23787610);
dd.driveTo(gp_start, gp_end, Mode.DRIVING, this);
- Geocoder gc = new Geocoder(getApplicationContext());
+/* Geocoder gc = new Geocoder(getApplicationContext());
try {
System.out.println("HEJSAN");
+ System.out.println("HEJSAN");
+ System.out.println("HEJSAN");
+ System.out.println("HEJSAN");
+ System.out.println("HEJSAN");
+ System.out.println("HEJSAN");
+ System.out.println("HEJSAN");
+ System.out.println("HEJSAN");
List<Address> hej = gc.getFromLocationName("ullevi", 10);
for(Address a : hej){
System.out.println("=======================" + a.getAddressLine(0));
@@ -100,7 +107,7 @@ public void onCreate(Bundle savedInstanceState) {
// TODO Auto-generated catch block
e.printStackTrace();
}
-
+*/
mapController = mapView.getController();
mapController.animateTo(gp_start);
@@ -224,21 +231,25 @@ protected void onActivityResult(int requestCode, int resultCode, Intent data) {
String from = d.get("from").toString();
String to = d.get("to").toString();
+
+
+ SearchApi api = new SearchApi();
+ api.geocoder = new Geocoder(getApplicationContext());
+ DirectionsForm directionForm = new DirectionsForm();
+ directionForm.startAtAddress(from);
+ directionForm.goToAddress(to);
+
+
+
+
// DO SOMETHING WITH THE RESULT FROM FIND_PATH
- Geocoder gc = new Geocoder(getApplicationContext());
Address fromAddress = null;
Address toAddress = null;
try {
- LocationManager lm = (LocationManager) getApplicationContext().getSystemService(Context.LOCATION_SERVICE);
- Location l = lm.getLastKnownLocation(lm.getBestProvider(null, true));
- if (l == null) {
-
- }
- double lon = l.getLongitude();
- double lat = l.getLatitude();
- gc.getFromLocation(lat, lon, 1).remove(0);
- fromAddress = gc.getFromLocationName(from, 1, lat+1, lon-1, lat-1, lon+1).remove(0);
- toAddress = gc.getFromLocationName(from, 1, lat+1, lon-1, lat-1, lon+1).remove(0);
+ List<Address> path = directionForm.getWalkPath(api);
+ fromAddress = path.get(0);
+ toAddress = path.get(1);
+
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
@@ -264,33 +275,4 @@ protected void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);
}
-
-/* static final int DIALOG_EXIT_ID = 1;
- @Override
- protected Dialog onCreateDialog(int id, Bundle args) {
- Dialog dialog;
- switch(id){
- case DIALOG_EXIT_ID:
- AlertDialog.Builder builder = new AlertDialog.Builder(this);
- builder.setMessage("Are you sure you want to exit?")
- .setCancelable(false)
- .setPositiveButton("Yes", new DialogInterface.OnClickListener() {
- public void onClick(DialogInterface dialog, int id) {
- GMapsActivity.this.finish();
- }
- })
- .setNegativeButton("No", new DialogInterface.OnClickListener() {
- public void onClick(DialogInterface dialog, int id) {
- dialog.cancel();
- }
- });
- AlertDialog alert = builder.create();
- dialog = alert;
- break;
- default:
- dialog= null;
- }
- return dialog;
- }
-*/
}

No commit comments for this range

Something went wrong with that request. Please try again.