aspose file tools*
The moose likes GWT and the fly likes GWT GDirections Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Frameworks » GWT
Bookmark "GWT GDirections " Watch "GWT GDirections " New topic
Author

GWT GDirections

Shane O' Brien
Greenhorn

Joined: Mar 11, 2011
Posts: 2
Hello,
I'm in the process of doing my thesis for college using Java and GWT. In the project I need to get a polyline that follows the shortest route between to markers. I was planning to do this using GDirections. I have the Google Maps API on the classpath and the map itself works fine, but when I try to create a GDirections object I get an error message saying that GDirections cannot be resolved to a type. I've found plenty of examples of it using Javascript but they aren't much good to me. Is there a something you have to do first before you can use GDirections? Any help would be much appreciated!

Cheers
Shane
Gokhan Urcan
Greenhorn

Joined: Apr 25, 2011
Posts: 2
Shane O' Brien wrote:Hello,
I'm in the process of doing my thesis for college using Java and GWT. In the project I need to get a polyline that follows the shortest route between to markers. I was planning to do this using GDirections. I have the Google Maps API on the classpath and the map itself works fine, but when I try to create a GDirections object I get an error message saying that GDirections cannot be resolved to a type. I've found plenty of examples of it using Javascript but they aren't much good to me. Is there a something you have to do first before you can use GDirections? Any help would be much appreciated!

Cheers
Shane


hello ,

I'am preparing a thesis on gwt , my thesis is ,using salesman travelling via genetic algorithm ,that means what ı must find shortest route between to point on googlemap , ı researched some sources and ı saw that i must use javasprict :S that is so confused
Shane O' Brien
Greenhorn

Joined: Mar 11, 2011
Posts: 2
I found a way around it without using javascript. The code below is how I did it.



You pass the DirectionQueryOptions object your map. You then call the Directions.loadFromWaypoints method and pass it a waypoint array (I've called mine waypoints), the DirectionQueryOptions object and create a new DirectionsCallback object. In the on success method you do whatever you need to do with the result. As you can see I got the polyline from the result and then added it to the map as well as getting the length.
Hope that helps
Cheers
Shane
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: GWT GDirections