简体   繁体   English

如何在JAVA中使用DirectionService()GWT

[英]How to use DirectionService() GWT in JAVA

Is there an example anywhere that deals with DirectionService() and is up-to-date? 是否有任何示例可以处理DirectionService()并且是最新的? and also in Java not javascript? 而且在Java中不是javascript吗?
I can't find it anywhere. 我在任何地方都找不到。 I want some concrete examples of how to use this. 我想要一些如何使用此示例。

Anyways Here are my questions: 无论如何,这是我的问题:

Set the renderer to use the result from the DirectionsService. 设置渲染器以使用DirectionsService的结果。 Setting a valid set of directions in this manner will display the directions on the renderer's designated map and panel. 以这种方式设置一组有效的方向将在渲染器的指定地图和面板上显示方向。

This is what it says on the Google Map DirectionRenderer().setDirection(). 这就是它在Google Map DirectionRenderer()。setDirection()上所说的内容。
And when I click to see DirectionServices, the only method is. 当我单击以查看DirectionServices时,唯一的方法是。

route(request:DirectionsRequest, callback:function(DirectionsResult, DirectionsStatus)) route(request:DirectionsRequest,callback:function(DirectionsResult,DirectionsStatus))

Which makes sense. 有道理。 but I have no idea how to use the callback. 但我不知道如何使用回调。 I've done some research but still errrors.. here are my codes. 我已经进行了一些研究,但仍然有误..这是我的代码。

DirectionsRequest req = DirectionsRequest.create();
req.setOrigin(userPosition);
req.setDestination(destination);
DirectionsService serv = DirectionsService.create();
serv.route(req, new ???????)

So, this is where I got stuck. 所以,这就是我卡住的地方。 The only help that I have ever found was https://github.com/branflake2267/GWT-Maps-V3-Api/blob/master/gwt-maps-showcase/src/main/java/com/google/gwt/maps/testing/client/maps/DirectionsServiceMapWidget.java 我找到的唯一帮助是https://github.com/branflake2267/GWT-Maps-V3-Api/blob/master/gwt-maps-showcase/src/main/java/com/google/gwt/maps /testing/client/maps/DirectionsServiceMapWidget.java
this link above. 上面的链接。 but they seem to use old version of gwt and my version doesn't work anymore. 但他们似乎使用的是gwt的旧版本,而我的版本不再起作用。 Please, any help is thankful! 请,任何帮助都是感激的!

figured out.... 想通了....

serv.route(req, new DirectionsService.Callback() {

        @Override
        public void handle(DirectionsResult a, DirectionsStatus b) {
            // TODO Auto-generated method stub

        }
    });

I sincerely hope someone would find this when they have this same problem 我衷心希望有人遇到同样的问题时能找到它

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM