No, I have not tried searching on this group.
But I have solved my problem :) It was very stupid :)
Google and Yahoo maps require point for center map. Microsoft does
not.
If one does not specify center (start point) for map, map shows just a
gray rectangle.
This method works properly:
protected native JavaScriptObject getMap(Element element)/*-{
var m = new $wnd.Mapstraction(element, 'google');
m.resizeTo(400,400);
m.setMapType(1);
var mpoint = new $wnd.LatLonPoint(26.258936, -80.189209);
m.setCenterAndZoom(mpoint, 12);
return m;
}-*/;
Eric, thanks for help!
Best regards,
Sergey
On 9 сент, 17:22, "Eric Ayers" <[EMAIL PROTECTED]> wrote:
> Have you tried searching on the Google Maps group? (Read the message
> "BEFORE YOU POST: Read our Suggested Posting Guidelines")
>
> http://groups.google.com/group/Google-Maps-API
>
> 2008/9/9 anglers <[EMAIL PROTECTED]>:
>
>
>
>
>
> > Well, in mapstraction.js in case of Google Maps there are such code:
>
> > this.maps[this.api].checkResize();
>
> > It means that checkResize() method is called for GMap...
>
> > But gray rectangle for Google and Yahoo maps is still here :)
>
> > On 9 сент, 16:40, anglers <[EMAIL PROTECTED]> wrote:
> >> Thanks for reply, Eric
> >> I`ll try it, mayby it will help
>
> >> I`m not using GWT Google Maps API (MapWidget is the part of it). In my
> >> case I should to edit mapstraction.js directly.
> >> Interesting fact:
> >> If I use Microsoft VE Maps, all works correctly, map is rendered,
> >> resizable etc
> >> But for Yahoo and Google maps there are gray rectangle :)
>
> >> On 9 сент, 16:17, "Eric Ayers" <[EMAIL PROTECTED]> wrote:
>
> >> > I suggested MapWidget.checkResize() because it has solved the problem you
> >> > are describing before:
>
> >> >http://groups.google.com/group/Google-Web-Toolkit/browse_thread/threa...
>
> >> > On Tue, Sep 9, 2008 at 7:21 AM, anglers <[EMAIL PROTECTED]> wrote:
>
> >> > > Well, it is not problem with resizing I believe... On this example
> >> > > there are
> >> > > gray map loading area with label within, it is resizable by client
> >> > > window resize event. There are controls too on the map :)
> >> > > But content of the map area is not loaded...
>
> >> > > SImple example:
>
> >> > > package com.test.client;
>
> >> > > import com.google.gwt.core.client.EntryPoint;
> >> > > import com.google.gwt.core.client.GWT;
> >> > > import com.google.gwt.core.client.JavaScriptObject;
> >> > > import com.google.gwt.core.client.GWT.UncaughtExceptionHandler;
> >> > > import com.google.gwt.user.client.Command;
> >> > > import com.google.gwt.user.client.DOM;
> >> > > import com.google.gwt.user.client.DeferredCommand;
> >> > > import com.google.gwt.user.client.Element;
> >> > > import com.google.gwt.user.client.Window;
> >> > > import com.google.gwt.user.client.WindowResizeListener;
>
> >> > > public class Index implements EntryPoint, WindowResizeListener {
>
> >> > > public static JavaScriptObject jso;
>
> >> > > public void onModuleLoad() {
> >> > > try{
>
> >> > > Window.addWindowResizeListener(this);
> >> > > DeferredCommand.addCommand(new Command() {
> >> > > public void execute() {
> >> > > onWindowResized(Window.getClientWidth(),
> >> > > Window.getClientHeight());
> >> > > GWT.setUncaughtExceptionHandler(new
> >> > > UncaughtExceptionHandler() {
> >> > > public void
> >> > > onUncaughtException(Throwable e) {
> >> > >
> >> > > Window.alert(e.toString());
> >> > > }
> >> > > });
> >> > > }
> >> > > });
> >> > > jso = getMap(DOM.getElementById("mapstraction"));
> >> > > addControls(jso);
> >> > > onWindowResized(Window.getClientWidth(),
> >> > > Window.getClientHeight());
>
> >> > > } catch (Exception e) {
> >> > > Window.alert(e.toString());
> >> > > }
> >> > > }
>
> >> > > public void onWindowResized(int width, int height) {
> >> > > resize(jso, width, height);
> >> > > }
>
> >> > > protected native JavaScriptObject getMap(Element element)/*-{
> >> > > var m = new $wnd.Mapstraction(element, 'google');
> >> > > m.resizeTo(400,400);
> >> > > m.setMapType(1);
> >> > > return m;
> >> > > }-*/;
>
> >> > > protected native void resize(JavaScriptObject o, int w, int h) /*-
> >> > > {
> >> > > o.resizeTo(w-50,h-50);
> >> > > }-*/;
>
> >> > > protected native void addControls(JavaScriptObject o) /*-{
> >> > > o.addLargeControls();
> >> > > }-*/;
> >> > > }
>
> >> > > Any ideas, guys?
>
> >> > > Best regards,
> >> > > Sergey
>
> >> > > On 9 сент, 13:12, "Eric Ayers" <[EMAIL PROTECTED]> wrote:
> >> > > > There is a method named 'checkResize()' which might help.
>
> >> > > > Notifies the map of a change of the size of its container. Call
> >> > > > this
> >> > > method
> >> > > > after the size of the container DOM object has changed, so that
> >> > > > the
> >> > > map can
> >> > > > adjust itself to fit the new size.
>
> >> > > > Call it after you attach you map to the DOM. I don't know why it
> >> > > > would be needed in your case, but its helped in similar cases in the
> >> > > > past.
>
> >> > > > 2008/9/9 anglers <[EMAIL PROTECTED]>:
>
> >> > > > > More correctly to use some DIV element, f.e. with name
> >> > > > > 'mapstraction',
> >> > > > > and
> >> > > > > use such code:
> >> > > > > ...
> >> > > > > JavaScriptObject jso = getMap(DOM.getElementById("mapstraction"));
> >> > > > > ...
>
> >> > > > > protected native JavaScriptObject getMap(Element element)/*-{
> >> > > > > var m = new $wnd.Mapstraction(element, 'google');
> >> > > > > m.resizeTo(400,400);
> >> > > > > return m;
> >> > > > > }-*/
>
> >> > > > > But it is not solves the problem. Just gray rectangle on the
> >> > > > > screen,
> >> > > > > 400x400 px.
> >> > > > > Does anybody know what is the reason of such map behavior?
>
> >> > > > > Best regards
>
> >> > > > > On 8 сент, 19:59, anglers <[EMAIL PROTECTED]> wrote:
> >> > > > >> Hi all!
>
> >> > > > >> I have some problem.
> >> > > > >> I`m trying to get Mapstraction functionality in my GWT
> >> > > > >> application.
>
> >> > > > >> In my main module I use this code:
> >> > > > >> ...
> >> > > > >> VerticalPanel ccc = new VerticalPanel();
> >> > > > >> ccc.setWidth("500px");
> >> > > > >> ccc.setHeight("500px");
> >> > > > >> JavaScriptObject jso = getMap( ccc.getElement());
> >> > > > >> RootPanel.get().add(ccc);
> >> > > > >> ...
>
> >> > > > >> And JSNI function is:
>
> >> > > > >> protected native JavaScriptObject getMap(Element element)/*-{
> >> > > > >> var m = new $wnd.Mapstraction(element, 'google');
> >> > > > >> m.resizeTo(400,400);
> >> > > > >> return m;
>
> >> > > > >> }-*/;
>
> >> > > > >> In result I have grey rectangle on the screen, "Powered by
> >> > > > >> Google" and
> >> > > > >> "Terms of use" labels below.
> >> > > > >> Map is not loaded, just grey area
>
> >> > > > >> Does anybody know what`s problem? Help me please to resolve this
>
> >> > > > >> Best regards
> >> > > > >> Sergey
>
> >> > > > --
> >> > > > Eric Z. Ayers - GWT Team - Atlanta, GA USAhttp://
> >> > > code.google.com/webtoolkit/
>
> >> > --
> >> > Eric Z. Ayers - GWT Team - Atlanta, GA
> >> > USAhttp://code.google.com/webtoolkit/
>
> --
> Eric Z. Ayers - GWT Team - Atlanta, GA USAhttp://code.google.com/webtoolkit/
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---