[GraphHopper] change style to route path

Laura Barroso laura at entumovil.cu
Wed Jan 28 15:59:42 UTC 2015


Hello everyone, Im trying to change the style of the route path, instead
of lines I want to put a bitmap. So far I havent came with a desirable
solution. Here's my code:
private Polyline createPolyline(GHResponse response) {
		Paint paintStroke = AndroidGraphicFactory.INSTANCE.createPaint();
		paintStroke.setBitmapShader(
		AndroidGraphicFactory.convertToBitmap(getResources().getDrawable(R.drawable.test)));

		paintStroke.setStyle(Style.STROKE);
		paintStroke.setColor(Color.WHITE);
	 paintStroke.setDashPathEffect(new float[] { 25, 15 });
		paintStroke.setStrokeWidth(5);
		Polyline line = new Polyline(
				(org.mapsforge.core.graphics.Paint) paintStroke,
				AndroidGraphicFactory.INSTANCE);
		List<LatLong> geoPoints = line.getLatLongs();
		PointList tmp = response.getPoints();
		for (int i = 0; i < response.getPoints().getSize(); i++) {
			geoPoints.add(new LatLong(tmp.getLatitude(i), tmp.getLongitude(i)));
		}

		il = response.getInstructions();
		myLocationOverlay.setIl(il);
		return line;
	}

What am I missing?
Thanks in advance.




More information about the GraphHopper mailing list