Permalink
Browse files

Merge pull request #1166 from osmdroid/bug/#1164

bug/#1164: fixed the broken segment joints for Polylines in demos
  • Loading branch information...
monsieurtanuki committed Oct 10, 2018
2 parents 78d28e4 + db3a7a9 commit cd40de9cc92277e41022edcfa289620a5b07dcd4
@@ -14,6 +14,7 @@
import android.os.Bundle;
import org.osmdroid.samplefragments.BaseSampleFragment;
import org.osmdroid.util.BoundingBox;
import org.osmdroid.util.GeoPoint;
import org.osmdroid.views.overlay.LineDrawer;
import org.osmdroid.views.overlay.milestones.MilestoneBitmapDisplayer;
@@ -48,15 +49,25 @@
private double mAnimatedMetersSoFar;
private boolean mAnimationEnded;
/**
* @since 6.0.3
*/
private final List<GeoPoint> mGeoPoints = getGeoPoints();
@Override
public String getSampleTitle() {
return TITLE;
}
@Override
public void onActivityCreated(Bundle savedInstanceState) {
mMapView.getController().setZoom(13.2);
mMapView.getController().setCenter(new GeoPoint(48.85792514768071,2.342640914879439));
mMapView.post(new Runnable() {
@Override
public void run() {
final BoundingBox boundingBox = BoundingBox.fromGeoPoints(mGeoPoints);
mMapView.zoomToBoundingBox(boundingBox, false, 30);
}
});
super.onActivityCreated(savedInstanceState);
}
@@ -68,7 +79,8 @@ protected void addOverlays() {
final Polyline line = new Polyline(mMapView);
line.setColor(COLOR_POLYLINE_STATIC);
line.setWidth(LINE_WIDTH_BIG);
line.setPoints(getGeoPoints());
line.setPoints(mGeoPoints);
line.getPaint().setStrokeCap(Paint.Cap.ROUND);
final List<MilestoneManager> managers = new ArrayList<>();
final MilestoneMeterDistanceSliceLister slicerForPath = new MilestoneMeterDistanceSliceLister();
final Bitmap bitmap = BitmapFactory.decodeResource(getResources(), org.osmdroid.library.R.drawable.next);
@@ -122,6 +134,7 @@ private Paint getStrokePaint(final int pColor, final float pWidth) {
paint.setStyle(Paint.Style.STROKE);
paint.setAntiAlias(true);
paint.setColor(pColor);
paint.setStrokeCap(Paint.Cap.ROUND);
return paint;
}
@@ -136,6 +136,7 @@ private void touch_up() {
line.setTitle("This is a polyline");
line.setPoints(geoPoints);
line.showInfoWindow();
line.getPaint().setStrokeCap(Paint.Cap.ROUND);
//example below
/*
line.setOnClickListener(new Polyline.OnClickListener() {

0 comments on commit cd40de9

Please sign in to comment.