KapoorVashisht / osmdroid

Automatically exported from code.google.com/p/osmdroid
0 stars 0 forks source link

NullPointer exception while try to draw a quite big polygon #551

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
When I try to draw a quite big polygon that comes from a GeoJson, it crashes
With the smaller ones I have no problems if I turn off hardware accelation

This is my source code:

    private void inicializarMapa() {
        final DisplayMetrics dm = context.getResources().getDisplayMetrics();
        mResourceProxy = new ResourceProxyImpl(getActivity().getApplicationContext());

        mPrefs = context.getSharedPreferences(Constants.PREFS_NAME, Context.MODE_PRIVATE);

        mMapController = mMapView.getController();
        mMapController.setZoom(5);
        // only do static initialisation if needed
        if (CloudmadeUtil.getCloudmadeKey().length() == 0) {
            CloudmadeUtil.retrieveCloudmadeKey(context.getApplicationContext());
        }

        this.mCompassOverlay = new CompassOverlay(context, new InternalCompassOrientationProvider(context), mMapView);

        mScaleBarOverlay = new ScaleBarOverlay(context);
        mScaleBarOverlay.setCentred(true);
        mScaleBarOverlay.setScaleBarOffset(dm.widthPixels / 2, 10);

        mMapView.setBuiltInZoomControls(true);
        mMapView.setMultiTouchControls(true);

        mMapView.getOverlays().add(this.mCompassOverlay);

        mMapView.getController().setZoom(mPrefs.getInt(Constants.PREFS_ZOOM_LEVEL, 10));
        mMapView.scrollTo(mPrefs.getInt(Constants.PREFS_SCROLL_X, 0), mPrefs.getInt(Constants.PREFS_SCROLL_Y, 0));

        mCompassOverlay.enableCompass();

        geoJsonService = new GeoJsonService(MapaIncidenciasFrgmt.this);
        //I get the geoJson from a restfull service
        geoJsonService.execute();
    }

    public void stopWaitForGeoJsonResponse(boolean exito) {
        final KmlDocument kmlDocument = new KmlDocument();
        mLog.info(appContext.getGeoJson());
        kmlDocument.parseGeoJSON(appContext.getGeoJson());
        final FolderOverlay kmlOverlay = (FolderOverlay) kmlDocument.mKmlRoot.buildOverlay(mMapView, null, null,
                kmlDocument);
        mMapView.getOverlays().add(kmlOverlay);
        mMapView.invalidate();

        // mMapView.zoomToBoundingBox(kmlDocument.mKmlRoot.getBoundingBox());
    }

This is the exception trace:

    08-05 09:28:08.852: W/dalvikvm(13887): threadid=1: thread exiting with uncaught exception (group=0x40bf91f8)
08-05 09:28:08.875: W/System.err(13887): java.lang.NullPointerException
08-05 09:28:08.875: W/System.err(13887):    at 
org.osmdroid.views.overlay.OverlayManager.onDraw(OverlayManager.java:113)
08-05 09:28:08.875: W/System.err(13887):    at 
org.osmdroid.bonuspack.overlays.FolderOverlay.draw(FolderOverlay.java:65)
08-05 09:28:08.883: W/System.err(13887):    at 
org.osmdroid.views.overlay.OverlayManager.onDraw(OverlayManager.java:120)
08-05 09:28:08.883: W/System.err(13887):    at 
org.osmdroid.views.MapView.dispatchDraw(MapView.java:924)
08-05 09:28:08.883: W/System.err(13887):    at 
android.view.View.buildDrawingCache(View.java:10740)
08-05 09:28:08.883: W/System.err(13887):    at 
android.view.ViewGroup.drawChild(ViewGroup.java:2741)
08-05 09:28:08.883: W/System.err(13887):    at 
android.view.ViewGroup.dispatchDraw(ViewGroup.java:2489)
08-05 09:28:08.883: W/System.err(13887):    at 
android.view.ViewGroup.drawChild(ViewGroup.java:2885)
08-05 09:28:08.883: W/System.err(13887):    at 
android.view.ViewGroup.dispatchDraw(ViewGroup.java:2489)
08-05 09:28:08.883: W/System.err(13887):    at 
android.view.ViewGroup.drawChild(ViewGroup.java:2885)
08-05 09:28:08.883: W/System.err(13887):    at 
android.support.v4.widget.DrawerLayout.drawChild(DrawerLayout.java:1089)
08-05 09:28:08.883: W/System.err(13887):    at 
android.view.ViewGroup.dispatchDraw(ViewGroup.java:2489)
08-05 09:28:08.883: W/System.err(13887):    at 
android.view.ViewGroup.drawChild(ViewGroup.java:2885)
08-05 09:28:08.883: W/System.err(13887):    at 
android.view.ViewGroup.dispatchDraw(ViewGroup.java:2489)
08-05 09:28:08.883: W/System.err(13887):    at 
android.view.ViewGroup.drawChild(ViewGroup.java:2885)
08-05 09:28:08.883: W/System.err(13887):    at 
android.view.ViewGroup.dispatchDraw(ViewGroup.java:2489)
08-05 09:28:08.883: W/System.err(13887):    at 
android.view.View.draw(View.java:11028)
08-05 09:28:08.883: W/System.err(13887):    at 
android.widget.FrameLayout.draw(FrameLayout.java:450)
08-05 09:28:08.883: W/System.err(13887):    at 
android.view.ViewGroup.drawChild(ViewGroup.java:2887)
08-05 09:28:08.883: W/System.err(13887):    at 
android.view.ViewGroup.dispatchDraw(ViewGroup.java:2489)
08-05 09:28:08.891: W/System.err(13887):    at 
android.view.View.draw(View.java:11028)
08-05 09:28:08.891: W/System.err(13887):    at 
android.support.v7.internal.widget.ActionBarOverlayLayout.draw(ActionBarOverlayL
ayout.java:500)
08-05 09:28:08.891: W/System.err(13887):    at 
android.view.ViewGroup.drawChild(ViewGroup.java:2887)
08-05 09:28:08.891: W/System.err(13887):    at 
android.view.ViewGroup.dispatchDraw(ViewGroup.java:2489)
08-05 09:28:08.891: W/System.err(13887):    at 
android.view.ViewGroup.drawChild(ViewGroup.java:2885)
08-05 09:28:08.891: W/System.err(13887):    at 
android.view.ViewGroup.dispatchDraw(ViewGroup.java:2489)
08-05 09:28:08.891: W/System.err(13887):    at 
android.view.ViewGroup.drawChild(ViewGroup.java:2885)
08-05 09:28:08.891: W/System.err(13887):    at 
android.view.ViewGroup.dispatchDraw(ViewGroup.java:2489)
08-05 09:28:08.891: W/System.err(13887):    at 
android.view.View.draw(View.java:11028)
08-05 09:28:08.891: W/System.err(13887):    at 
android.widget.FrameLayout.draw(FrameLayout.java:450)
08-05 09:28:08.891: W/System.err(13887):    at 
com.android.internal.policy.impl.PhoneWindow$DecorView.draw(PhoneWindow.java:227
4)
08-05 09:28:08.899: W/System.err(13887):    at 
android.view.ViewRootImpl.draw(ViewRootImpl.java:2041)
08-05 09:28:08.899: W/System.err(13887):    at 
android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:1647)
08-05 09:28:08.899: W/System.err(13887):    at 
android.view.ViewRootImpl.handleMessage(ViewRootImpl.java:2459)
08-05 09:28:08.899: W/System.err(13887):    at 
android.os.Handler.dispatchMessage(Handler.java:99)
08-05 09:28:08.899: W/System.err(13887):    at 
android.os.Looper.loop(Looper.java:137)
08-05 09:28:08.899: W/System.err(13887):    at 
android.app.ActivityThread.main(ActivityThread.java:4514)
08-05 09:28:08.899: W/System.err(13887):    at 
java.lang.reflect.Method.invokeNative(Native Method)
08-05 09:28:08.899: W/System.err(13887):    at 
java.lang.reflect.Method.invoke(Method.java:511)
08-05 09:28:08.899: W/System.err(13887):    at 
com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:790)
08-05 09:28:08.899: W/System.err(13887):    at 
com.android.internal.os.ZygoteInit.main(ZygoteInit.java:557)
08-05 09:28:08.899: W/System.err(13887):    at 
dalvik.system.NativeStart.main(Native Method)

Thanks

Original issue reported on code.google.com by a.otero....@gmail.com on 5 Aug 2015 at 7:26