示例“用于GWT的Google Maps API v3” Eclipse项目 [英] Example "Google Maps API v3 for GWT" Project for Eclipse

查看:124
本文介绍了示例“用于GWT的Google Maps API v3” Eclipse项目的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

谷歌为GWT发布官方地图v3 API https ://groups.google.com/forum/#!topic / gwt-google-apis / 6SO5kCDqb-k
(请注意, http://code.google.com/p/gwt-google-maps-v3/ 已被弃用且不是官方的。)



我已经下载了zip文件,里面有示例,但它们都是java。我无法弄清楚如何在我的project.gwt.xml文件中继承它,或者写入我的主html或将gwt-maps.jar文件放在哪里。

是否有任何完整的Eclipse GWT项目为OFFICIAL API开头?或任何指导链接,解释如何从零开始,我的第一个类有OnModuleLoad()?



谢谢

解决方案

这里有一些提示可以帮助您开始:

gwt-maps.jar 应放置在您的 prject.gwt.xml

>你可能会添加< module> 部分:

 << ;继承了name =com.google.maps.gwt.GoogleMaps/> 
< script src =http://maps.google.com/maps/api/js?sensor=false/>

这会在加载页面时加载加载地图api。



以下是我的应用程序中的复制/粘贴行,按照您的需求安排它们:

  MapOptions选项= MapOptions。创建() ; 

options.setCenter(LatLng.create(latCenter,lngCenter));
options.setZoom(6);
options.setMapTypeId(MapTypeId.ROADMAP);
options.setDraggable(true);
options.setMapTypeControl(true);
options.setScaleControl(true);
options.setScrollwheel(true);

SimplePanel widg = new SimplePanel();

widg.setSize(100%,100%);

GoogleMap theMap = GoogleMap.create(widg.getElement(),options);

RootLayoutPanel.get()。add(widg);

这将构建一个带有地图的小部件。


Google released official maps v3 API for GWT here https://groups.google.com/forum/#!topic/gwt-google-apis/6SO5kCDqb-k (Note that http://code.google.com/p/gwt-google-maps-v3/ is deprecated and is not official.)

I have downloaded the zip file and there are samples in it but they are all java. I can not figure out how to inherit it in my project.gwt.xml or what to write into my main html or where to put the gwt-maps.jar file.

Is there any complete Eclipse GWT project "for the OFFICIAL API" to start with? Or any guidance link which explains how to start from zero to my first class which has the OnModuleLoad()?

Thanks

解决方案

Here are a few tips to help you get starting:

gwt-maps.jar should be placed in WEB-INF/lib

in your prject.gwt.xml you might add in your <module> section:

<inherits name="com.google.maps.gwt.GoogleMaps" />
<script src="http://maps.google.com/maps/api/js?sensor=false" />

this will make loading maps api when loading page.

Followings are copy/paste lines from my app, arrange them to match your needs:

        MapOptions options  = MapOptions.create() ;

    options.setCenter(LatLng.create( latCenter, lngCenter ));   
    options.setZoom( 6 ) ;
    options.setMapTypeId( MapTypeId.ROADMAP );
    options.setDraggable(true);
    options.setMapTypeControl(true);
    options.setScaleControl(true) ;
    options.setScrollwheel(true) ;

    SimplePanel widg = new SimplePanel() ;

    widg.setSize("100%","100%");

    GoogleMap theMap = GoogleMap.create( widg.getElement(), options ) ;

    RootLayoutPanel.get().add( widg ) ;

This will build a widget with a map inside.

这篇关于示例“用于GWT的Google Maps API v3” Eclipse项目的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆