[+gwt - where possible please use the developer forum or GWTC] None of the public classes in the maps source code use the G prefix. It seems like you are looking at some other library. If you want to see a really detailed example that uses a large portion of the Maps API you should check out the source code under http://code.google.com/p/gwt-google-apis/source/browse/#svn/trunk/maps/samples/hellomaps. It will answer most of your questions.
HTH, On Tue, Aug 19, 2008 at 4:05 PM, agnes Laffitte <[EMAIL PROTECTED]>wrote: > I saw your video on : http://www.youtube.com/watch?v=sz6txhPT7vQ > I had a few questions. > The code you gave in your presentation: > package com.example.google.gwt.mapstutorial.client; > > import com.google.gwt.core.client.EntryPoint; > import com.google.gwt.maps.client.MapWidget; > import com.google.gwt.maps.client.control.SmallMapControl; > import com.google.gwt.user.client.ui.RootPanel; > > public class MapsTutorial implements EntryPoint { > > public void onModuleLoad() { > > MapWidget mw = new MapWidget(); > mw.addControl(new SmallMapControl()); > mw.setSize("500px", "500px"); > RootPanel.get().add(mw); > } > } > works well when I tried it. > About the two other codes: > class CustomZoomControl extends CustomControl { > protected Widget initialize (final MapWidge map){ > Panel container = new FlowPanel(); > Button zoomInButtonn = new FlowPanel(); > Button zoomInButton = new Button("Zoom In"); > zoomInButton.addClickListener(new ClickListener(){ > public void onClick(Widget sender){ > map.zoomIn(); > } > }); > container.add(zoomInButton); > return container; > } > public boolean isSelectable() { > return false; > } > } > > class RectangleOverlay extends Overlay { > public RectangleOverlay(LatLngBounds bounds, int weight) > protected Overlay copyt() > protected void initialize(MapWidge map) > protected void redraw(boolean force) > protected ovid remove() > } > > where do you put these fragments into eclipse. Do you put them in the > public void onModuleLoad(){ > //code goes in here > } > or no? > And lastly, I found this example in javascript, and wanted to them in Java > using the following library: > > http://gwt-google-apis.googlecode.com/svn/javadoc/1.1/maps/overview-summary.html > > http://google-web-toolkit.googlecode.com/svn-history/r2433/javadoc/1.4/overview-summary.html > > Example: > /General setup nothing too interesting > RootPanel.get("slot2").add(searchStatusText); > GMap2Widget mapWidget = new GMap2Widget("500px", "500px"); > RootPanel.get("slot4").add(mapWidget); > final GMap2 map = mapWidget.getGmap(); > map.addControl(GControl.GSmallZoomControl()); > Element e = RootPanel.get("directions").getElement(); > > //Create the GDirections object and associate it to the map... you can > create it without any map association (which means the API won't > automatically put the route on the map, but you'll still get the > results). Also if you want to use Google's step by step directions on > your page pass a Element object for a div (as in the example below). > > final GDirections gd = new GDirections(map, e); > > // Stronly recommend that you listen for the "load" event before > attempting to access any of the result objects, lest you will be > burdened with copious amounts of error messages. An example of how to > do that is below. > > GEventListener listener = GEvent.addListener(gd, "load", new > GEventHandler(){ > > public void onHandle(JSObject source, JSObject[] param) { > > GDirectionsDistance distance = gd.getDistance(); > GDirectionsDuration duration = gd.getDuration(); > > GRoute route = gd.getRoute(0); > int steps = route.getNumSteps(); > GLatLng end = route.getEndLatLng(); > distance = route.getDistance(); > duration = route.getDuration(); > String summary = route.getSummaryHtml(); > > GStep step = route.getStep(0); > GLatLng step_first = step.getLatLng(); > int step_polyline_index = step.getPolylineIndex(); > String step_desc = step.getDescriptionHtml(); > GDirectionsDistance step_distance = > step.getDistance(); > GDirectionsDuration step_duration = > step.getDuration(); > > distance = step_distance; > duration = step_duration; > > GLog.write("Distance in miles: " + > distance.getMiles()); > GLog.write("Time in seconds: " + > duration.getSeconds()); > GLog.write(distance.getHtml()); > GLog.write(duration.getHtml()); > > int days = duration.getDays(); > int hours = duration.getHours(); > int minutes = duration.getMinutes(); > int seconds = duration.getSeconds(); > > GPlaceMark gpm = gd.getGeocode(0); > String name = gpm.getAddress(); > GLatLng pos = gpm.getPoint(); > int accuracy = gpm.getAccuracy(); > String country = gpm.getCountry(); > String state = gpm.getState(); > String postalCode = gpm.getPostalCode(); > String streetLine = gpm.getStreetLine(); > String city = gpm.getCity(); > String county = gpm.getCounty(); > > GMarker m = gd.getMarker(0); > GLatLng ltln = m.getPoint(); > > GLog.write(gd.getSummaryHtml()); > GPolyline gp = gd.getPolyline(); > GLatLngBounds bounds = gd.getBounds(); > int numRoutes = gd.getNumRoutes(); > int numGeocodes = gd.getNumGeocodes(); > GGecodeStatus status = gd.getStatus(); > int s = status.getCode().getValue(); > String request = status.getRequest(); > > // gd.clear(); > > }}); > > //You can specify options which define the behaviour of the > GDirections search > GDirectionsOptions gdo = new GDirectionsOptions(); > gdo.setGetPolyline(true); > gdo.setPreserveViewport(true); > gdo.setLocale("fr_CA"); > > // Option 1 - call the load method > // gd.load("from:Austin, TX to: San Jose", gdo); > > //Option 2 - use the waypoints method > String[] locations = {"4807 Fern Hollow, Austin, TX 78731", > "Mountain View, CA 94043"}; > gd.loadFromWaypoints(locations, gdo); > > //Add in a GTrafficOverlay for good sake > GTrafficOverlay gto = new GTrafficOverlay(); > map.addOverlay(gto); > gto.hide(); > gto.show(); > > > I wasn't sure how to convert particular: GEventListener listener = > GEvent.addListener(gd, "load", new > GEventHandler(){ > > public void onHandle(JSObject source, JSObject[] > into Java. I am not familiar with Javascript but I am familiar with Java, > and I am not too familiar with the Google Maps Api Java library , I am > learning it. I was wondering besides solving these if possible, if you had > more sample code using the Google Maps API using JAVA. Your attention to > this matter is highly appreciated. > > Sincerely, > Agnes Laffitte > > -- Miguel --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/Google-Web-Toolkit?hl=en -~----------~----~----~----~------~----~------~--~---
