Fix issue with path taking too long to be drawn due to useless syncrhonization.
This commit is contained in:
parent
4af68f9f93
commit
8200497675
@ -414,9 +414,11 @@ public class MapViewDrawing extends MapView implements Drawing {
|
||||
@Override
|
||||
public PathOverlay drawPath(Path path, Color color, boolean markers) {
|
||||
PolylineAutoScaling line = new PolylineAutoScaling(1, DEFAULT_PATH_COLOR);
|
||||
ArrayList<Point> points = new ArrayList<>(path.getArcs().size() * 4);
|
||||
for (Arc arc: path.getArcs()) {
|
||||
line.add(arc.getPoints());
|
||||
points.addAll(arc.getPoints());
|
||||
}
|
||||
line.addAll(points);
|
||||
PathOverlay overlay = null;
|
||||
if (markers) {
|
||||
MarkerAutoScaling origin = createMarker(path.getOrigin().getPoint(),
|
||||
|
@ -1,7 +1,8 @@
|
||||
package org.insa.graphics.drawing.overlays;
|
||||
|
||||
import java.awt.Color;
|
||||
import java.util.List;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
|
||||
import org.insa.graph.Point;
|
||||
import org.mapsforge.core.graphics.Canvas;
|
||||
@ -70,10 +71,12 @@ public class PolylineAutoScaling extends Polyline {
|
||||
/**
|
||||
* @param points Points to add to this line.
|
||||
*/
|
||||
public void add(List<Point> points) {
|
||||
public void addAll(Collection<? extends Point> points) {
|
||||
ArrayList<LatLong> latlongs = new ArrayList<>(points.size());
|
||||
for (Point point: points) {
|
||||
add(point);
|
||||
latlongs.add(new LatLong(point.getLatitude(), point.getLongitude()));
|
||||
}
|
||||
getLatLongs().addAll(latlongs);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
Loading…
Reference in New Issue
Block a user