The Maps v3 API you've been waiting for, now in pre-release

Showing 1-17 of 17 messages
The Maps v3 API you've been waiting for, now in pre-release Eric Ayers 3/30/12 1:43 PM
We've worked with the Maps team to create an updated GWT bindings API
for Maps v3.  I've uploaded a pre-release now that you can check out
at:

  http://code.google.com/p/gwt-google-apis/downloads/detail?name=gwt-maps-3.8.0-pre1.zip

Thanks to the work of David Carlson, this API is automatically
generated from metadata coming directly from the Maps API source.  The
great news is that since the API is now automatically generated, we
expect that we will be able to periodically release updates that will
keep them in sync with the published JS apis.  On the other hand,
since these are mechanically translated from the JS API, some of the
conventions might be a little odd to Java programmers.

For the casually curious, you can peruse the javadoc:

  http://gwt-google-apis.googlecode.com/svn/javadoc/maps/3.8/index.html

Currently, the sample code and the directions for trying them out are
a little rough, we hope to make that nicer before the actual release.

Please followup to this thread if you have any questions.

-Eric.
--
Eric Ayers | Software Engineer | zun...@google.com | +1 404 487 9229

Re: The Maps v3 API you've been waiting for, now in pre-release Brandon Donnelson 3/30/12 4:39 PM
Wahoo! :) Nice work.

Brandon Donnelson
Re: [gwt-google-apis] Re: The Maps v3 API you've been waiting for, now in pre-release lifeoflust 3/30/12 5:49 PM
Brandon,

On cursory examination:

  • Javadoc comments are quite incomplete in their auto generated classes, just the text block clipped from the JS API. No @link, @see, @param, @return etc for better Eclipse auto-suggestion and JavaDocs.
  • All constructors use create(), now uses of createJso() or newInstance()
  • All numeric inputs are double, whereas yours uses ints (assuming this is b/c only true numeric type in JS is double)
  • They stick to the letter to the JS API, so while you use a Java Enum as the ScaleControlStyle enum, they don't, thus for that type they have 7 method calls defined, while you just do 3 since the Enum type handles the rest (i.e. they must do ScaleControlStyle.getDefault(), you do ScaleControlStyle.DEFAULT) (i.e. since they are not an Enum, they use an internal registry of Map<Double,ScaleControlStyle> to store values. Seems wasteful).
  • Classes like MVCObject are not generics like yours, and only JS types are used (string, boolean, jso). This would make it harder to access using Java.
  • Because of use of doubles, array indexes like in MVCArray are looked up by double, not int, which seems odd if you're accessing from Java.
  • Requests don't use work around to prevent gwt_object dev mode errors in Chrome (which folks will notice I bet).
  • Different names, they make a new GoogleMap.create(), you make a MapImpl.newInstance() - only object in src prefixed with Google... funny, this is GWT, right?
    • They create map with a Node, you use Element. Official API says Node.
    • Seems they found the gwt_Object error here, it's removed if not running as isScript()

Obviously the two are not the same. My take away is that their implementation tries to stay as close to the JS as possible, even making their implementation notably more complex in places, rather than using the Java equivalent types. This probably is a wash or slight gain once compiled to JS, but does not seem to be as good a fit for GWT Java programming, and defies the reasoning of using the GWT compiler to transition from Java to JS. As a Java programmer, I would rather use Java idioms for Enums, rather than a clunky JS inspired Java wrapper for an Enum.

The plus is that theirs is generated from the GMaps source, so it would be easier to maintain in theory, but a diff of the API docs from one Maps release to the next would also allow straight forward upgrading of your API too, which is replete with tests I don't see in theirs, though they might have them somewhere as the full source is not out.


Sincerely,
Joseph


--
You are subscribed to the Google Groups "GWT-Google-Apis" group.
For more options, visit http://groups.google.com/group/gwt-google-apis?hl=en

unk...@googlegroups.com 3/30/12 6:13 PM <This message has been deleted.>
unk...@googlegroups.com 3/30/12 6:16 PM <This message has been deleted.>
Re: [gwt-google-apis] Re: The Maps v3 API you've been waiting for, now in pre-release Brandon Donnelson 3/30/12 6:18 PM
Thanks for the awesome summary Joseph. 
Re: The Maps v3 API you've been waiting for, now in pre-release Piers 4/1/12 1:51 AM
I just tried swapping out gwt-maps3-0.2b and I'm getting the following
exceptions depending on when I create the map.


com.google.gwt.core.client.JavaScriptException: (TypeError): Cannot
read property 'maps' of undefined
    at
com.google.gwt.dev.shell.BrowserChannelServer.invokeJavascript(BrowserChannelServer.java:
248)
    at
com.google.gwt.dev.shell.ModuleSpaceOOPHM.doInvoke(ModuleSpaceOOPHM.java:
136)
    at
com.google.gwt.dev.shell.ModuleSpace.invokeNative(ModuleSpace.java:
561)
    at
com.google.gwt.dev.shell.ModuleSpace.invokeNativeObject(ModuleSpace.java:
269)
    at
com.google.gwt.dev.shell.JavaScriptHost.invokeNativeObject(JavaScriptHost.java:
91)
    at com.google.maps.gwt.client.LatLng$.create(LatLng.java)
    at com.milkrun.client.ui.AppAdminView.buildMap(AppAdminView.java:
36)
    at com.milkrun.client.ui.AppAdminView.<init>(AppAdminView.java:32)
    at
com.milkrun.client.ClientFactoryImpl.<clinit>(ClientFactoryImpl.java:
51)


I simply took the MapSimple.java code and included it into my app:

        public void buildMap(){
            LatLng myLatLng = LatLng.create(-34.397, 150.644);
            MapOptions myOptions = MapOptions.create();
            myOptions.setZoom(8.0);
            myOptions.setCenter(myLatLng);
            myOptions.setMapTypeId(MapTypeId.ROADMAP);
            GoogleMap.create(mapContainerPanel.getElement(), myOptions); //
mapContainerPanel is a SimplePanel
        }

my javascript is pretty weak but I gather it's similar to a java null
pointer exception for 'maps'. Any insight into what this is and why
it's returning null?
Re: [gwt-google-apis] Re: The Maps v3 API you've been waiting for, now in pre-release Eric Ayers 4/1/12 7:35 AM
Looks like you don't have the Maps API loaded.  You'll need to load it
with the AjaxLoader API or a <script> tag .  See the README file.

> --
> You are subscribed to the Google Groups "GWT-Google-Apis" group.
> For more options, visit http://groups.google.com/group/gwt-google-apis?hl=en

--

Eric Ayers | Software Engineer | zun...@google.com | +1 404 487 9229

unk...@googlegroups.com 4/1/12 4:03 PM <This message has been deleted.>
unk...@googlegroups.com 4/1/12 10:20 PM <This message has been deleted.>
Re: The Maps v3 API you've been waiting for, now in pre-release Piers 4/2/12 12:47 AM


On Apr 1, 7:35 am, Eric Ayers <zun...@google.com> wrote:
> Looks like you don't have the Maps API loaded.  You'll need to load it
> with the AjaxLoader API or a <script> tag .  See the README file.
>
>
>
>
>
>
>
>
>
> > For more options, visithttp://groups.google.com/group/gwt-google-apis?hl=en
>
> --
> Eric Ayers | Software Engineer | zun...@google.com | +1 404 487 9229begin_of_the_skype_highlighting            +1 404 487 9229      I feel a little foolish. Sorry I did load the API but I copied the wrong stack trace.

From what the little bit more reading I've done I think it's due to
the rendering sequence with the declarative layout. Would it be
possible to include an example using UiBinder for those of us who use
it?

Caused by: com.google.gwt.core.client.JavaScriptException:
(TypeError): Cannot read property 'offsetWidth' of null
    at
com.google.gwt.dev.shell.BrowserChannelServer.invokeJavascript(BrowserChannelServer.java:
248)
    at
com.google.gwt.dev.shell.ModuleSpaceOOPHM.doInvoke(ModuleSpaceOOPHM.java:
136)
    at
com.google.gwt.dev.shell.ModuleSpace.invokeNative(ModuleSpace.java:
561)
    at
com.google.gwt.dev.shell.ModuleSpace.invokeNativeObject(ModuleSpace.java:
269)
    at
com.google.gwt.dev.shell.JavaScriptHost.invokeNativeObject(JavaScriptHost.java:
91)
    at com.google.maps.gwt.client.GoogleMap$.create(GoogleMap.java)
    at com.milkrun.client.ui.AppAdminView.renderMap(AppAdminView.java:
50)
    at
com.milkrun.client.activity.AppNavActivity.start(AppNavActivity.java:
37)
    at
com.google.gwt.activity.shared.ActivityManager.tryStart(ActivityManager.java:
214)
    at
com.google.gwt.activity.shared.ActivityManager.onPlaceChange(ActivityManager.java:
141)
    at
com.google.gwt.place.shared.PlaceChangeEvent.dispatch(PlaceChangeEvent.java:
70)
    at
com.google.gwt.place.shared.PlaceChangeEvent.dispatch(PlaceChangeEvent.java:
1)
    at com.google.gwt.event.shared.GwtEvent.dispatch(GwtEvent.java:1)
    at
com.google.web.bindery.event.shared.EventBus.dispatchEvent(EventBus.java:
40)
    at
com.google.web.bindery.event.shared.SimpleEventBus.doFire(SimpleEventBus.java:
193)
    at
com.google.web.bindery.event.shared.SimpleEventBus.fireEvent(SimpleEventBus.java:
88)
    at
com.google.gwt.event.shared.SimpleEventBus.fireEvent(SimpleEventBus.java:
52)
    at
com.google.gwt.place.shared.PlaceController.goTo(PlaceController.java:
156)
    at
com.milkrun.client.ui.AppHeaderView.onListBasketButtonClick(AppHeaderView.java:
50)

Thanks for the quick response.
Re: The Maps v3 API you've been waiting for, now in pre-release JoyaleXandre 4/2/12 2:49 PM
Is it normal that when I reload the same composite twice, the second time the map layout is all mixed up? If I do a complete refresh all is OK.

Le vendredi 30 mars 2012 16:43:44 UTC-4, Eric Ayers a écrit :
Re: The Maps v3 API you've been waiting for, now in pre-release cyclingthealps 4/15/12 6:38 AM
Cool Eric!!!

I am already using the bindings of Brandon Donnelson!
He did a fantastic job on this as well!!

Interesting to see the summary of Joseph as well.

Thanks for the work. 
Working with the Maps API in GWT is just great!

Cheers

Am Freitag, 30. März 2012 22:43:44 UTC+2 schrieb Eric Ayers:Am Freitag, 30. März 2012 22:43:44 UTC+2 schrieb Eric Ayers:Am Freitag, 30. März 2012 22:43:44 UTC+2 schrieb Eric Ayers:Am Freitag, 30. März 2012 22:43:44 UTC+2 schrieb Eric Ayers:Am Freitag, 30. März 2012 22:43:44 UTC+2 schrieb Eric Ayers:Am Freitag, 30. März 2012 22:43:44 UTC+2 schrieb Eric Ayers:Am Freitag, 30. März 2012 22:43:44 UTC+2 schrieb Eric Ayers:Am Freitag, 30. März 2012 22:43:44 UTC+2 schrieb Eric Ayers:Am Freitag, 30. März 2012 22:43:44 UTC+2 schrieb Eric Ayers:Am Freitag, 30. März 2012 22:43:44 UTC+2 schrieb Eric Ayers:Am Freitag, 30. März 2012 22:43:44 UTC+2 schrieb Eric Ayers:Am Freitag, 30. März 2012 22:43:44 UTC+2 schrieb Eric Ayers:
Re: [gwt-google-apis] Re: The Maps v3 API you've been waiting for, now in pre-release Eric Ayers 4/15/12 3:43 PM

This is mostly the work of David Carlson with integration help from the Maps Api team out of Sydney.  I'm glad Brandon's work is out there too.

--
You are subscribed to the Google Groups "GWT-Google-Apis" group.
For more options, visit http://groups.google.com/group/gwt-google-apis?hl=en
Re: [gwt-google-apis] Re: The Maps v3 API you've been waiting for, now in pre-release Brandon Donnelson 4/15/12 6:21 PM
Thank you :)

Have a good day,
Brandon Donnelson
Re: [gwt-google-apis] Re: The Maps v3 API you've been waiting for, now in pre-release lifeoflust 4/16/12 3:52 PM
Eric,

Congrats on your and David's work. My apologies if my commentary was at all acerbic.


Sincerely,
Joseph
Binding a polyline and marker dubiousandrew 4/17/12 9:58 AM
I have been playing around with the new API.  I have been trying to
figure out how I can bind a polyline and a marker.  So that when the
marker is moved or the line is edited both update their positions.  I
would like to do something like this:

public class Line extends MVCObject {
        MVCArray<LatLng> array;
        public Line(MVCArray<LatLng> array){
                this.array = array;
        }
        public LatLng get(String key){//ERROR Cannot override final method
from MVCObject
                return this.array.getAt(Double.parseDouble(key));
        }
        public void set(String key, LatLng latlng){
                this.array.setAt(Double.parseDouble(key), latlng);
        }
        public MVCArray<LatLng> getPath(){
                return array;
        }

}

//create a polyline
PolylineOptions polyOpts = PolylineOptions.create();
polyOpts.setStrokeColor("red");
polyOpts.setStrokeOpacity(0.5);
polyOpts.setStrokeWeight(3);
polyOpts.setEditable(true);
Polyline poly = Polyline.create(polyOpts);

//bind the polyline to a line
MVCArray<LatLng> array = MVCArray.create();
Line line = new Line(array);
line.getPath().push(latlng);
poly.setPath(line.getPath());
poly.setMap(map);

//create a marker
MarkerOptions markerOptions = MarkerOptions.create();
markerOptions.setMap(map);
markerOptions.setTitle("Hello World!");
markerOptions.setDraggable(true);
Marker start = Marker.create(markerOptions);

//bind the marker to the begining of the line
start.bindTo("position", line, "0");


But I am not allowed to do it because I cannot override the final get
method of the MVCObject.
Is there something else I can do to bind a marker and a polyline?  I
can't seem to figure it out.  Any help would be greatly appreciated.
-Andrew

On Mar 30, 2:43 pm, Eric Ayers <zun...@google.com> wrote:
> We've worked with the Maps team to create an updated GWT bindings API
> for Maps v3.  I've uploaded a pre-release now that you can check out
> at:
>
>  http://code.google.com/p/gwt-google-apis/downloads/detail?name=gwt-ma...