Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

GWT GDirections

 
Shane O' Brien
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic