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

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

问题描述

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

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.)

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

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.

是否有任何完整的 Eclipse GWT 项目用于官方 API"?或者任何说明如何从零开始到我的第一个具有 OnModuleLoad() 的类的指导链接?

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()?

谢谢

推荐答案

以下是一些帮助您入门的提示:

Here are a few tips to help you get starting:

gwt-maps.jar 应该放在 WEB-INF/lib 中

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

在您的 prject.gwt.xml 中,您可以在 部分添加:

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" />

这将使加载页面时加载地图api.

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.

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

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