Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>thx etteyafed for your answer</p> <p>the problem was </p> <pre><code>if (shadow == false) </code></pre> <p>the working code here:</p> <pre><code>if (shadow == false) { if ((bmap == null) || (lastLatSpan != mapv.getLatitudeSpan()) || true) { // bitmap is null - so we haven't previously drawn the path, OR // the map has been zoomed in/out, so we're gonna re-draw it // anyway // (alternatively, I could have tried scaling the bitmap... // might // be worth investigating if that is more efficient) // create a new bitmap, the size of the map view Canvas offscreencanvas = new Canvas(); bmap = Bitmap.createBitmap(mapv.getWidth(), mapv.getHeight(), Bitmap.Config.ARGB_8888); bmap.copy(Config.ARGB_4444, true); offscreencanvas.setBitmap(bmap); mCanvas = offscreencanvas; Path path = null; Projection projection = mapv.getProjection(); lastLatSpan = mapv.getLatitudeSpan(); for (int j = 0; j &lt; mTourenArray.length; j++) { GeoPoint[] route = GeoPointFactory .createGeoPointArray(mTourenArray[j] .getGeoPointArray()); defaultColor = mTourenArray[j].getColorByCat(); path = new Path(); Paint polyPaint = new Paint(); polyPaint.setColor(defaultColor); for (int i = 0; i &lt; route.length - 1; i++) { GeoPoint gp1 = route[i]; GeoPoint gp2 = route[i + 1]; polyPaint.setAntiAlias(true); Point point = new Point(); projection.toPixels(gp1, point); // mode=1&amp;#65306;start if (i == 0) { Point point2 = new Point(); projection.toPixels(gp2, point2); RectF oval = new RectF(point.x - mRadius, point.y - mRadius, point.x + mRadius, point.y + mRadius); // start point offscreencanvas.drawOval(oval, polyPaint); path.moveTo(point.x, point.y); path.lineTo(point2.x, point2.y); } /* mode=3&amp;#65306;end */ else if (i == route.length - 2) { /* the last path */ Point point2 = new Point(); projection.toPixels(gp2, point2); path.lineTo(point2.x, point2.y); RectF oval = new RectF(point2.x - mRadius, point2.y - mRadius, point2.x + mRadius, point2.y + mRadius); /* end point */ polyPaint.setAlpha(255); offscreencanvas.drawOval(oval, polyPaint); } // mode=2&amp;#65306;path else if (i &lt; route.length - 2 &amp; i != 0) { Point point2 = new Point(); projection.toPixels(gp2, point2); path.lineTo(point2.x, point2.y); } } // create an off-screen canvas to prepare new bitmap, and // draw path on to it polyPaint.setStrokeWidth(5); polyPaint.setStyle(Paint.Style.STROKE); polyPaint.setAntiAlias(true); polyPaint.setAlpha(defaultColor == Color .parseColor("#6C8715") ? 220 : 120); offscreencanvas.drawPath(path, polyPaint); } // Outer For End // draw the bitmap of the path onto my map view's canvas // And set these pixels to destination bitmap: canvas.drawBitmap(bmap, 0, 0, null); panAfterZoom(mapv, 600); // make a note of where we put the bitmap, so we know how // much we // we need to move it by if the user pans the map mapStartPosition = projection.fromPixels(0, 0); } else { // as we're in onDraw, we think the user has panned/moved the // map // if we're in here, the zoom level hasn't changed, and // we've already got a bitmap with a drawing of the route path Projection proj = mapv.getProjection(); // where has the mapview been panned to? Point offsetPt = new Point(); proj.toPixels(mapStartPosition, offsetPt); // start point // create a new bitmap, the size of the map view // draw the bitmap in the new correct location canvas.drawBitmap(bmap, offsetPt.x, offsetPt.y, null); } } return super.draw(canvas, mapv, shadow, when); } </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload