witchupan / gwt-maps-api

Automatically exported from code.google.com/p/gwt-maps-api
0 stars 0 forks source link

Using your Google Map V3 wrapper #1

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
Hi
I started to use your library some days ago in my geo-localized blog 
(www.elmolideponent.com) and it works fine!
I want to comment you the changes that I have done locally:

1. I implemented GwtEvent.getSource() for the map events.
2. I changed the maps version to "3.7" because with version "3" I got a poor 
performance.
3. I removed 
   impl = MapImpl.newInstance(div, options);
 from MapWidget(...) constructor because some times I had problems with the downloading of the map tiles if the main <div> was not rendered already in the browser.

Thank you very much!
Joan Ribalta

Original issue reported on code.google.com by JOANRIBA...@gmail.com on 23 Feb 2012 at 11:35

GoogleCodeExporter commented 8 years ago
Hi,
I started to use your library and i have some problems with MapWidget 
when i tried to display several maps in tabItems , the first map is well 
displayed but the second is not displayed correctelly !

I had attached 2 screen shots to explain more my issue. 

i'll be so gratefull if you can help me to solve this blocking probleme.

Original comment by bouallou...@gmail.com on 28 Feb 2012 at 11:56

Attachments:

GoogleCodeExporter commented 8 years ago
This is because the div where the map is included must be rendered before 
downloading of the map tiles. You can modify the MagWidget of the library 
excluding impl = MapImpl.newInstance(div, options); and doing it after the div 
is already rendered.

Original comment by JOANRIBA...@gmail.com on 28 Feb 2012 at 12:22

GoogleCodeExporter commented 8 years ago
thanks for your quick answer.
but can you give me more details on the modifications you did on the library, i 
cant find where did you put your new sources.

Original comment by bouallou...@gmail.com on 28 Feb 2012 at 2:21

GoogleCodeExporter commented 8 years ago
Below you have my changes in this case but I didn't analysed the whole wrapper 
library!. I call MagWidget.go(...) once the MapWidget is rendered...

{
...
  public MapWidget() {
    div = DOM.createDiv();
    setElement(div);

    setStyleName("gwt-map-MapWidget-div");
  }

  public MapImpl go(MapOptions options)
  {
     impl = MapImpl.newInstance(div, options);      
     return impl;
  }  
...

Original comment by JOANRIBA...@gmail.com on 28 Feb 2012 at 3:35

GoogleCodeExporter commented 8 years ago
Does this happen when you deploy to server? Are you debugging with Chrome or 
firefox?

Original comment by branflak...@gmail.com on 28 Feb 2012 at 5:13

GoogleCodeExporter commented 8 years ago
It may be in chrome, and if so there is a bug I need to fix.

Original comment by branflak...@gmail.com on 28 Feb 2012 at 5:14

GoogleCodeExporter commented 8 years ago
Can you check the javascript console and see if there is a __gwt_Object Id 
error?

Original comment by branflak...@gmail.com on 28 Feb 2012 at 5:17

GoogleCodeExporter commented 8 years ago
I debugging with Firefox and I have not error in the console of firebug 

Original comment by bouallou...@gmail.com on 29 Feb 2012 at 8:12

GoogleCodeExporter commented 8 years ago
hello JOAN,
i did all the modifcations you've suggested me to do, i called the method 
go(..) in the afterrender method, but i had the same result as above.

before using this library, i was using another GWT map JAR 
(http://code.google.com/p/gwt-google-maps-v3/), and i have a perfect result 
with displaying several maps on different tabitem, but infortunately it was 
poor of other fonctionnality that ii need to work with like drawing library 
...etc

I had attached a sample project to explain more my issue. 

Original comment by bouallou...@gmail.com on 29 Feb 2012 at 11:06

Attachments:

GoogleCodeExporter commented 8 years ago
Now I'm travelling, so for me it is impossible to check it. 

The important thing is that the div (inside MapWidget) must be totally rendered 
with its final size before calling the go! I guess that you can put the "go" 
inside the onSelection handler of the tab panel and then put something like   
Scheduler.get().scheduleDeferred(new Scheduler.ScheduledCommand()
{
   public void execute()
   {
       ...go(..)
   }
});

Original comment by JOANRIBA...@gmail.com on 29 Feb 2012 at 1:27

GoogleCodeExporter commented 8 years ago
Hi, You dont need to do any modification! Like JOANRIBA said the rendering is 
the problem, but this u can solve it by calling 
MapHandlerRegistration.trigger(map, MapEventType.RESIZE);
after the div containing the map gets is last size...

Hope this help:)

Original comment by baze...@gmail.com on 2 Mar 2012 at 10:03

GoogleCodeExporter commented 8 years ago
Hi,

I have one question to Joan!

What do you mean by 
"I changed the maps version to "3.7" because with version "3" I got a poor 
performance".

where do you change this version?

Blaze

Original comment by baze...@gmail.com on 2 Mar 2012 at 10:30

GoogleCodeExporter commented 8 years ago
The Google Maps Library has a minor in the version: 
http://code.google.com/apis/maps/documentation/javascript/basics.html
The wrapper fixes the version to "3" that gets the last version in development
...load(...)
{
 AjaxLoader.loadApi("maps", "3.7", onLoad, settings);
}
Apparently, I get better performance with 3.7, but I only did superficial 
testes! 

Original comment by JOANRIBA...@gmail.com on 2 Mar 2012 at 3:23

GoogleCodeExporter commented 8 years ago
i'm trying to use google's geocoder service to get an adress of a position 
defined by latitude and longitude.
but my probleme is that i can't get the "results" object wich contain a list of 
adresses to manipulate it outside of the "geocode" method

this is my code :

ArrayList<LoadLibrary> loadLibraries = new ArrayList<LoadApi.LoadLibrary>();
loadLibraries.add(LoadLibrary.PLACES);   

Runnable onLoad = new Runnable() {
      public void run() {
        System.err.println("chargement avec success");
        Geocoder o = Geocoder.newInstance();
        GeocoderRequest request = GeocoderRequest.newInstance();
        LatLng location = LatLng.newInstance(37.12639, 3.64056);
    request.setLocation(location);

    o.geocode(request , new GeocoderRequestHandler() {
    public void onCallback(JsArray<GeocoderResult> results, GeocoderStatus status) {
                    if (status == GeocoderStatus.OK) {

                      if (results.length() > 0) {
                          for (int i=0; i < results.length(); i++) {
                              GeocoderResult result = results.get(i);

                              JsArray<GeocoderAddressComponent> components = result.getAddress_Components();
                              int len = components.length();

                              String address = result.getFormatted_Address();
                              System.err.println("address : "+address);
                          }
                      }
                    } else {
                        System.err.println("Erreur pas d'adresse  : -------------------------");
                    }

                  }
                });

          }
        };

        LoadApi.go(onLoad, loadLibraries, sensor);

please help me to understand more this service

Original comment by bouallou...@gmail.com on 15 Mar 2012 at 7:37