Skip to content

Commit

Permalink
Merge pull request #1166 from osmdroid/bug/#1164
Browse files Browse the repository at this point in the history
bug/#1164: fixed the broken segment joints for Polylines in demos
  • Loading branch information
monsieurtanuki committed Oct 10, 2018
2 parents 78d28e4 + db3a7a9 commit cd40de9
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -48,15 +49,25 @@ public class SampleRace extends BaseSampleFragment {
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);
}
Expand All @@ -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);
Expand Down Expand Up @@ -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;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand Down

0 comments on commit cd40de9

Please sign in to comment.