Hi -
When defining a custom Projection using GWT 1.5.2 and gwt-maps-1.0
RC1, I can't seem to get around this:
com.google.gwt.dev.shell.HostedModeException: Expected primitive type
boolean; actual value was undefined
at com.google.gwt.dev.shell.JsValueGlue.get(JsValueGlue.java:51)
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:
155)
at
com.google.gwt.dev.shell.ie.IDispatchImpl.Invoke(IDispatchImpl.java:
294)
at
com.google.gwt.dev.shell.ie.IDispatchImpl.method6(IDispatchImpl.java:
194)
at
org.eclipse.swt.internal.ole.win32.COMObject.callback6(COMObject.java:
117)
at org.eclipse.swt.internal.ole.win32.COM.VtblCall(Native Method)
at org.eclipse.swt.internal.ole.win32.IDispatch.Invoke(IDispatch.java:
64)
at org.eclipse.swt.ole.win32.OleAutomation.invoke(OleAutomation.java:
493)
at org.eclipse.swt.ole.win32.OleAutomation.invoke(OleAutomation.java:
417)
at
com.google.gwt.dev.shell.ie.ModuleSpaceIE6.doInvokeOnWindow(ModuleSpaceIE6.java:
67)
at
com.google.gwt.dev.shell.ie.ModuleSpaceIE6.doInvoke(ModuleSpaceIE6.java:
152)
at com.google.gwt.dev.shell.ModuleSpace.invokeNative(ModuleSpace.java:
447)
at
com.google.gwt.dev.shell.ModuleSpace.invokeNativeVoid(ModuleSpace.java:
248)
at
com.google.gwt.dev.shell.JavaScriptHost.invokeNativeVoid(JavaScriptHost.java:
107)
at
com.google.gwt.maps.client.impl.__MapImplImpl.checkResize(transient
source for com.google.gwt.maps.client.impl.__MapImplImpl)
at com.google.gwt.maps.client.MapWidget.checkResize(MapWidget.java:
729)
at com.google.gwt.maps.client.MapWidget.onAttach(MapWidget.java:1507)
at com.google.gwt.user.client.ui.Widget.setParent(Widget.java:231)
at com.google.gwt.user.client.ui.Panel.adopt(Panel.java:119)
at com.google.gwt.user.client.ui.ComplexPanel.add(ComplexPanel.java:
86)
at com.google.gwt.user.client.ui.AbsolutePanel.add(AbsolutePanel.java:
80)
at
com.cyface.northmoor.map.client.NorthmoorMap.onModuleLoad(NorthmoorMap.java:
64)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:
39)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:
25)
at java.lang.reflect.Method.invoke(Method.java:597)
at com.google.gwt.dev.shell.ModuleSpace.onLoad(ModuleSpace.java:320)
at
com.google.gwt.dev.shell.BrowserWidget.attachModuleSpace(BrowserWidget.java:
329)
at com.google.gwt.dev.shell.ie.BrowserWidgetIE6.access
$300(BrowserWidgetIE6.java:37)
at
com.google.gwt.dev.shell.ie.BrowserWidgetIE6$External.gwtOnLoad(BrowserWidgetIE6.java:
76)
at
com.google.gwt.dev.shell.ie.BrowserWidgetIE6$External.invoke(BrowserWidgetIE6.java:
139)
at
com.google.gwt.dev.shell.ie.IDispatchImpl.Invoke(IDispatchImpl.java:
294)
at
com.google.gwt.dev.shell.ie.IDispatchImpl.method6(IDispatchImpl.java:
194)
at
org.eclipse.swt.internal.ole.win32.COMObject.callback6(COMObject.java:
117)
at org.eclipse.swt.internal.win32.OS.DispatchMessageW(Native Method)
at org.eclipse.swt.internal.win32.OS.DispatchMessage(OS.java:1925)
at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:2966)
at com.google.gwt.dev.GWTShell.pumpEventLoop(GWTShell.java:720)
at com.google.gwt.dev.GWTShell.run(GWTShell.java:593)
at com.google.gwt.dev.GWTShell.main(GWTShell.java:357)
My projection class:
public class NorthmoorMapProjection extends Projection {
int imageDimension = 65536;
int maxZoom = 5;
int tileSize = 256;
Point[] pixelOrigin = new Point[maxZoom];
int[] pixelsPerLonDegree = new int[maxZoom];
int[] tileBounds = new int[maxZoom];
boolean isWrapped = false;
public NorthmoorMapProjection() {
int currentTileSize = this.tileSize;
int currentTileBounds = 1;
for (int zoomLevel = 0; zoomLevel < this.maxZoom; zoomLevel++) {
int tileCenter = currentTileSize / 2;
this.pixelsPerLonDegree[zoomLevel] = currentTileSize /
360;
this.pixelOrigin[zoomLevel] =
Point.newInstance(tileCenter,
tileCenter);
this.tileBounds[zoomLevel] = currentTileBounds;
currentTileSize *= 2;
currentTileBounds *= 2;
}
}
@Override
public Point fromLatLngToPixel(LatLng latLng, int zoomLevel) {
Point pixelOrigin = this.pixelOrigin[zoomLevel];
int pixelOriginX = pixelOrigin.getX();
int pixelOriginY = pixelOrigin.getY();
int pixelsPerLonDegreeForCurrentZoom =
this.pixelsPerLonDegree[zoomLevel];
double currentLongitude = latLng.getLongitude();
double currentLatitude = latLng.getLatitude();
long newX = Math.round(pixelOriginX + currentLongitude *
pixelsPerLonDegreeForCurrentZoom);
long newY = Math.round(pixelOriginY + (-2 * currentLatitude) *
pixelsPerLonDegreeForCurrentZoom);
int newXint = new Long(newX).intValue();
int newYint = new Long(newY).intValue();
return Point.newInstance(newXint, newYint);
}
@Override
public LatLng fromPixelToLatLng(Point point, int zoomLevel, boolean
unbounded) {
Point pixelOrigin = this.pixelOrigin[zoomLevel];
int pixelOriginX = pixelOrigin.getX();
int pixelOriginY = pixelOrigin.getY();
int pixelsPerLonDegreeForCurrentZoom =
this.pixelsPerLonDegree[zoomLevel];
int currentX = point.getX();
int currentY = point.getY();
double d = currentX - pixelOriginX /
pixelsPerLonDegreeForCurrentZoom;
double e = -0.5 * (currentY - pixelOriginY) /
pixelsPerLonDegreeForCurrentZoom;
return LatLng.newInstance(e, d, unbounded);
}
@Override
public double getWrapWidth(int zoomLevel) {
return this.tileBounds[zoomLevel] * this.tileSize;
}
@Override
public boolean tileCheckRange(TileIndex index, int zoomLevel, int
tileSize) {
int tileBounds = this.tileBounds[zoomLevel];
int newX = index.getX();
if (index.getY() < 0 || index.getY() >= tileBounds) {
return false;
}
if (this.isWrapped) {
if (index.getX() < 0 || index.getX() >= tileBounds) {
newX = index.getX() % tileBounds;
if (index.getX() < 0) {
newX += tileBounds;
}
}
} else {
if (index.getX() < 0 || index.getX() >= tileBounds) {
return false;
}
}
return true;
}
Any thoughts? Thanks!
Tim
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---