Closed GoogleCodeExporter closed 9 years ago
Possibly related to issue 39.
Original comment by gwt.team...@gmail.com
on 4 Feb 2008 at 7:46
Google-web-toolkit group reference:
http://groups.google.com/group/Google-Web-Toolkit/browse_thread/thread/80729d407
91eca39/b8a6432e8a23ab38?lnk=gst&q=Feedback+requested%3A+Google+API+Library+supp
ort+for+Google+Maps+and+AJAX+Search#b8a6432e8a23ab38
Here's some sample code from user COCGIS that causes the problem:
I tried a simpler example, a customized tile layer, started from the
js sample at
http://www.google.com/apis/maps/documentation/overlays.html#Tile_Laye....
but I ran into problem with MapType
public void onModuleLoad() {
final MapWidget map= new MapWidget(new LatLng(35.249208,
-80.843099), 10);
map.setSize("500px", "500px");
CopyrightCollection myCopyright=new CopyrightCollection("");
myCopyright.addCopyright(new Copyright(1,new LatLngBounds(new
LatLng(34,-81),new LatLng(36,-79)),10,""));
TileLayer tileLayer = new TileLayer(myCopyright,10,18){
public boolean isPng(){return true;}
public double getOpacity(){return 1.0;}
public String getTileURL(Point tile, int zoomLevel){
return "http://www.google.com/apis/maps/documentation/
examples/include/tile_crosshairs.png";
}
};
//TileLayerOverlay layerOverlay=new TileLayerOverlay(tileLayer);
//map.addOverlay(layerOverlay);
MapType mapType=new MapType(new TileLayer[]{tileLayer},new
MercatorProjection(20),"MyMap");
map.addMapType(mapType);
map.addControl(new MapTypeControl());
RootPanel.get().add(map);//
}
The tile layer works fine as a tile overlay on top of normal maps,
however,
when I click the "MyMap" type, I got the following error:
com.google.gwt.dev.shell.HostedModeException: Calling method
'createPeer': JS object of type number, expected
com.google.gwt.core.client.JavaScriptObject
at com.google.gwt.dev.shell.JsValueGlue.get(JsValueGlue.java:114)
at
com.google.gwt.dev.shell.ie.SwtOleGlue.convertVariantsToObjects(SwtOleGlue.java:
57)
at
com.google.gwt.dev.shell.ie.IDispatchImpl.callMethod(IDispatchImpl.java:
119)
at
com.google.gwt.dev.shell.ie.IDispatchProxy.invoke(IDispatchProxy.java:
150)
--
1. The Projection.tileCheckRange method's signature changed from the
js API, and I don't think it is because of naming convention as in the
case of getTileURL. The last parameter tilesize is
com.google.gwt.maps.client.geom.Size instead of int. However, in the
runtime, what's been passed in by the js API is actually a number
(256), causing the errors. (Calling method 'createPeer': JS object of
type number, expected com.google.gwt.core.client.JavaScriptObject).
2. In the js API, a typical use of GProjection class is call method
fromLatLngToPixel etc in overlay or control class to position stuff on
top the map, but com.google.gwt.maps.client.geom.MercatorProjection
has those two method as protected, so you can not really have some
code like:
Projection prj=new MercatorProjection(20);
Point p=prj.fromLatLngToPixel(new LatLng(40, -80));
which is supposed to be a "correct" use. Any special reason why those
methods are protected? They are meant to be called.
Original comment by gwt.team...@gmail.com
on 14 Feb 2008 at 4:53
Added patches that fix the original reported issue and issues #1 & #2 later in
the
groups thread.
Original comment by gwt.team...@gmail.com
on 15 Feb 2008 at 4:03
Attachments:
The projection patch also addresses issue #58
Original comment by gwt.team...@gmail.com
on 16 Feb 2008 at 10:24
galgwt-Projection-fixups-issue29-r120.patch committed as r124.
Original comment by gwt.team...@gmail.com
on 20 Feb 2008 at 3:35
galgwt-custom-MapType-issue29-r120.patch committed as r125.
Original comment by gwt.team...@gmail.com
on 20 Feb 2008 at 3:38
Original comment by galgwt.reviews@gmail.com
on 9 Jun 2008 at 11:30
Original comment by galgwt.reviews@gmail.com
on 13 Oct 2008 at 8:54
Original comment by galgwt.reviews@gmail.com
on 11 Dec 2008 at 3:08
Original comment by zundel@google.com
on 21 Dec 2009 at 1:57
Original issue reported on code.google.com by
gwt.team...@gmail.com
on 28 Sep 2007 at 8:19