Merge branch 'master' into follow_track_fixes
This commit is contained in:
commit
69e5293412
9 changed files with 146 additions and 97 deletions
|
@ -1283,7 +1283,7 @@
|
||||||
<string name="mapillary_widget">Mapillary widget</string>
|
<string name="mapillary_widget">Mapillary widget</string>
|
||||||
<string name="mapillary_widget_descr">Allows quick contributions to Mapillary.</string>
|
<string name="mapillary_widget_descr">Allows quick contributions to Mapillary.</string>
|
||||||
<string name="mapillary_descr">Online street-level photos for everyone. Discover places, collaborate, capture the world.</string>
|
<string name="mapillary_descr">Online street-level photos for everyone. Discover places, collaborate, capture the world.</string>
|
||||||
<string name="mapillary">Street-level imagery</string>
|
<string name="mapillary">Mapillary</string>
|
||||||
<string name="plugin_mapillary_descr">Street-level photos for everyone. Discover places, collaborate, capture the world.</string>
|
<string name="plugin_mapillary_descr">Street-level photos for everyone. Discover places, collaborate, capture the world.</string>
|
||||||
<string name="private_access_routing_req">Your destination is located in an area with private access. Allow using private roads for this trip?</string>
|
<string name="private_access_routing_req">Your destination is located in an area with private access. Allow using private roads for this trip?</string>
|
||||||
<string name="restart_search">Restart search</string>
|
<string name="restart_search">Restart search</string>
|
||||||
|
|
|
@ -10,6 +10,8 @@ import android.widget.Toast;
|
||||||
|
|
||||||
import androidx.appcompat.app.AlertDialog;
|
import androidx.appcompat.app.AlertDialog;
|
||||||
|
|
||||||
|
import net.osmand.plus.GpxSelectionHelper;
|
||||||
|
import net.osmand.plus.GpxSelectionHelper.SelectedGpxFile;
|
||||||
import net.osmand.plus.OsmandApplication;
|
import net.osmand.plus.OsmandApplication;
|
||||||
import net.osmand.plus.R;
|
import net.osmand.plus.R;
|
||||||
import net.osmand.plus.SQLiteTileSource;
|
import net.osmand.plus.SQLiteTileSource;
|
||||||
|
@ -128,7 +130,13 @@ public class FileUtils {
|
||||||
dest.getParentFile().mkdirs();
|
dest.getParentFile().mkdirs();
|
||||||
}
|
}
|
||||||
if (source.renameTo(dest)) {
|
if (source.renameTo(dest)) {
|
||||||
|
GpxSelectionHelper helper = ctx.getSelectedGpxHelper();
|
||||||
|
SelectedGpxFile selected = helper.getSelectedFileByPath(source.getAbsolutePath());
|
||||||
ctx.getGpxDbHelper().rename(source, dest);
|
ctx.getGpxDbHelper().rename(source, dest);
|
||||||
|
if (selected != null && selected.getGpxFile() != null) {
|
||||||
|
selected.getGpxFile().path = dest.getAbsolutePath();
|
||||||
|
helper.updateSelectedGpxFile(selected);
|
||||||
|
}
|
||||||
if (callback != null) {
|
if (callback != null) {
|
||||||
callback.renamedTo(dest);
|
callback.renamedTo(dest);
|
||||||
}
|
}
|
||||||
|
|
|
@ -318,7 +318,7 @@ public class DashboardOnMap implements ObservableScrollViewCallbacks, IRouteInfo
|
||||||
} else if (visibleType == DashboardType.OVERLAY_MAP) {
|
} else if (visibleType == DashboardType.OVERLAY_MAP) {
|
||||||
tv.setText(R.string.map_overlay);
|
tv.setText(R.string.map_overlay);
|
||||||
} else if (visibleType == DashboardType.MAPILLARY) {
|
} else if (visibleType == DashboardType.MAPILLARY) {
|
||||||
tv.setText(R.string.mapillary);
|
tv.setText(R.string.street_level_imagery);
|
||||||
} else if (visibleType == DashboardType.CONTOUR_LINES) {
|
} else if (visibleType == DashboardType.CONTOUR_LINES) {
|
||||||
tv.setText(R.string.srtm_plugin_name);
|
tv.setText(R.string.srtm_plugin_name);
|
||||||
} else if (visibleType == DashboardType.OSM_NOTES) {
|
} else if (visibleType == DashboardType.OSM_NOTES) {
|
||||||
|
|
|
@ -181,7 +181,7 @@ public class MapillaryPlugin extends OsmandPlugin {
|
||||||
}
|
}
|
||||||
adapter.addItem(new ContextMenuItem.ItemBuilder()
|
adapter.addItem(new ContextMenuItem.ItemBuilder()
|
||||||
.setId(MAPILLARY)
|
.setId(MAPILLARY)
|
||||||
.setTitleId(R.string.mapillary, mapActivity)
|
.setTitleId(R.string.street_level_imagery, mapActivity)
|
||||||
.setDescription("Mapillary")
|
.setDescription("Mapillary")
|
||||||
.setSelected(settings.SHOW_MAPILLARY.get())
|
.setSelected(settings.SHOW_MAPILLARY.get())
|
||||||
.setColor(settings.SHOW_MAPILLARY.get() ? R.color.osmand_orange : ContextMenuItem.INVALID_ID)
|
.setColor(settings.SHOW_MAPILLARY.get() ? R.color.osmand_orange : ContextMenuItem.INVALID_ID)
|
||||||
|
|
|
@ -596,10 +596,10 @@ public class MeasurementEditingContext {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void updateProgress(int progress) {
|
public void updateProgress(int progress) {
|
||||||
int pairs = calculatedPairs + pointsToCalculateSize;
|
int pairs = pointsToCalculateSize;
|
||||||
if (pairs != 0) {
|
if (pairs != 0) {
|
||||||
int pairProgress = 100 / pairs;
|
float pairProgress = 100f / pairs;
|
||||||
progress = calculatedPairs * pairProgress + progress / pairs;
|
progress = (int)(calculatedPairs * pairProgress + (float) progress / pairs);
|
||||||
}
|
}
|
||||||
progressListener.updateProgress(progress);
|
progressListener.updateProgress(progress);
|
||||||
}
|
}
|
||||||
|
@ -633,6 +633,7 @@ public class MeasurementEditingContext {
|
||||||
pts.add(pt);
|
pts.add(pt);
|
||||||
}
|
}
|
||||||
calculatedPairs++;
|
calculatedPairs++;
|
||||||
|
params.calculationProgressCallback.updateProgress(0);
|
||||||
List<RouteSegmentResult> originalRoute = route.getOriginalRoute();
|
List<RouteSegmentResult> originalRoute = route.getOriginalRoute();
|
||||||
if (Algorithms.isEmpty(originalRoute)) {
|
if (Algorithms.isEmpty(originalRoute)) {
|
||||||
originalRoute = Collections.singletonList(routePlannerFrontEnd.generateStraightLineSegment(
|
originalRoute = Collections.singletonList(routePlannerFrontEnd.generateStraightLineSegment(
|
||||||
|
|
|
@ -472,13 +472,6 @@ public class MeasurementToolFragment extends BaseOsmAndFragment implements Route
|
||||||
displaySegmentPoints();
|
displaySegmentPoints();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/*
|
|
||||||
if (saved == null) {
|
|
||||||
saved = gpxData != null
|
|
||||||
&& (gpxData.getActionType() == ActionType.ADD_ROUTE_POINTS
|
|
||||||
|| gpxData.getActionType() == ActionType.EDIT_SEGMENT);
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1443,6 +1436,7 @@ public class MeasurementToolFragment extends BaseOsmAndFragment implements Route
|
||||||
|
|
||||||
private ProgressDialog progressDialog;
|
private ProgressDialog progressDialog;
|
||||||
private File toSave;
|
private File toSave;
|
||||||
|
private GPXFile savedGpxFile;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onPreExecute() {
|
protected void onPreExecute() {
|
||||||
|
@ -1494,6 +1488,7 @@ public class MeasurementToolFragment extends BaseOsmAndFragment implements Route
|
||||||
}
|
}
|
||||||
Exception res = GPXUtilities.writeGpxFile(toSave, gpx);
|
Exception res = GPXUtilities.writeGpxFile(toSave, gpx);
|
||||||
gpx.path = toSave.getAbsolutePath();
|
gpx.path = toSave.getAbsolutePath();
|
||||||
|
savedGpxFile = gpx;
|
||||||
if (showOnMap) {
|
if (showOnMap) {
|
||||||
app.getSelectedGpxHelper().selectGpxFile(gpx, true, false);
|
app.getSelectedGpxHelper().selectGpxFile(gpx, true, false);
|
||||||
}
|
}
|
||||||
|
@ -1564,6 +1559,7 @@ public class MeasurementToolFragment extends BaseOsmAndFragment implements Route
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Exception res = GPXUtilities.writeGpxFile(toSave, gpx);
|
Exception res = GPXUtilities.writeGpxFile(toSave, gpx);
|
||||||
|
savedGpxFile = gpx;
|
||||||
if (showOnMap) {
|
if (showOnMap) {
|
||||||
SelectedGpxFile sf = app.getSelectedGpxHelper().selectGpxFile(gpx, true, false);
|
SelectedGpxFile sf = app.getSelectedGpxHelper().selectGpxFile(gpx, true, false);
|
||||||
if (sf != null) {
|
if (sf != null) {
|
||||||
|
@ -1592,6 +1588,13 @@ public class MeasurementToolFragment extends BaseOsmAndFragment implements Route
|
||||||
mapActivity.refreshMap();
|
mapActivity.refreshMap();
|
||||||
if (warning == null) {
|
if (warning == null) {
|
||||||
editingCtx.setChangesSaved();
|
editingCtx.setChangesSaved();
|
||||||
|
if (editingCtx.isNewData() && savedGpxFile != null) {
|
||||||
|
QuadRect rect = savedGpxFile.getRect();
|
||||||
|
TrkSegment segment = savedGpxFile.getNonEmptyTrkSegment();
|
||||||
|
GpxData gpxData = new GpxData(savedGpxFile, rect, ActionType.EDIT_SEGMENT, segment);
|
||||||
|
editingCtx.setGpxData(gpxData);
|
||||||
|
updateToolbar();
|
||||||
|
}
|
||||||
if (isInEditMode()) {
|
if (isInEditMode()) {
|
||||||
dismiss(mapActivity);
|
dismiss(mapActivity);
|
||||||
} else {
|
} else {
|
||||||
|
@ -1604,8 +1607,13 @@ public class MeasurementToolFragment extends BaseOsmAndFragment implements Route
|
||||||
@Override
|
@Override
|
||||||
public void onClick(View view) {
|
public void onClick(View view) {
|
||||||
MapActivity mapActivity = mapActivityRef.get();
|
MapActivity mapActivity = mapActivityRef.get();
|
||||||
if (mapActivity != null && AndroidUtils.isActivityNotDestroyed(mapActivity)) {
|
if (AndroidUtils.isActivityNotDestroyed(mapActivity)) {
|
||||||
FileUtils.renameFile(mapActivity, toSave, null);
|
FileUtils.renameFile(mapActivity, toSave, new FileUtils.RenameCallback() {
|
||||||
|
@Override
|
||||||
|
public void renamedTo(File file) {
|
||||||
|
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
|
@ -12,6 +12,7 @@ import net.osmand.GPXUtilities.WptPt;
|
||||||
import net.osmand.Location;
|
import net.osmand.Location;
|
||||||
import net.osmand.data.LatLon;
|
import net.osmand.data.LatLon;
|
||||||
import net.osmand.data.PointDescription;
|
import net.osmand.data.PointDescription;
|
||||||
|
import net.osmand.data.QuadRect;
|
||||||
import net.osmand.data.RotatedTileBox;
|
import net.osmand.data.RotatedTileBox;
|
||||||
import net.osmand.plus.R;
|
import net.osmand.plus.R;
|
||||||
import net.osmand.plus.settings.backend.ApplicationMode;
|
import net.osmand.plus.settings.backend.ApplicationMode;
|
||||||
|
@ -178,6 +179,7 @@ public class MeasurementToolLayer extends OsmandMapLayer implements ContextMenuL
|
||||||
new Renderable.StandardTrack(new ArrayList<>(after.points), 17.2).
|
new Renderable.StandardTrack(new ArrayList<>(after.points), 17.2).
|
||||||
drawSegment(view.getZoom(), lineAttrs.paint, canvas, tb);
|
drawSegment(view.getZoom(), lineAttrs.paint, canvas, tb);
|
||||||
|
|
||||||
|
drawPoints(canvas, tb);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -185,6 +187,7 @@ public class MeasurementToolLayer extends OsmandMapLayer implements ContextMenuL
|
||||||
public void onDraw(Canvas canvas, RotatedTileBox tb, DrawSettings settings) {
|
public void onDraw(Canvas canvas, RotatedTileBox tb, DrawSettings settings) {
|
||||||
if (inMeasurementMode) {
|
if (inMeasurementMode) {
|
||||||
lineAttrs.updatePaints(view.getApplication(), settings, tb);
|
lineAttrs.updatePaints(view.getApplication(), settings, tb);
|
||||||
|
drawBeforeAfterPath(canvas, tb);
|
||||||
|
|
||||||
if (editingCtx.getSelectedPointPosition() == -1) {
|
if (editingCtx.getSelectedPointPosition() == -1) {
|
||||||
drawCenterIcon(canvas, tb, settings.isNightMode());
|
drawCenterIcon(canvas, tb, settings.isNightMode());
|
||||||
|
@ -203,90 +206,115 @@ public class MeasurementToolLayer extends OsmandMapLayer implements ContextMenuL
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
TrkSegment before = editingCtx.getBeforeTrkSegmentLine();
|
List<WptPt> beforePoints = editingCtx.getBeforePoints();
|
||||||
TrkSegment after = editingCtx.getAfterTrkSegmentLine();
|
List<WptPt> afterPoints = editingCtx.getAfterPoints();
|
||||||
|
if (beforePoints.size() > 0) {
|
||||||
canvas.rotate(-tb.getRotate(), tb.getCenterPixelX(), tb.getCenterPixelY());
|
drawPointIcon(canvas, tb, beforePoints.get(beforePoints.size() - 1));
|
||||||
|
|
||||||
if (before.points.size() > 0 || after.points.size() > 0) {
|
|
||||||
path.reset();
|
|
||||||
tx.clear();
|
|
||||||
ty.clear();
|
|
||||||
|
|
||||||
if (before.points.size() > 0) {
|
|
||||||
WptPt pt = before.points.get(before.points.size() - 1);
|
|
||||||
float locX = tb.getPixXFromLatLon(pt.lat, pt.lon);
|
|
||||||
float locY = tb.getPixYFromLatLon(pt.lat, pt.lon);
|
|
||||||
tx.add(locX);
|
|
||||||
ty.add(locY);
|
|
||||||
tx.add((float) tb.getCenterPixelX());
|
|
||||||
ty.add((float) tb.getCenterPixelY());
|
|
||||||
}
|
|
||||||
if (after.points.size() > 0) {
|
|
||||||
if (before.points.size() == 0) {
|
|
||||||
tx.add((float) tb.getCenterPixelX());
|
|
||||||
ty.add((float) tb.getCenterPixelY());
|
|
||||||
}
|
|
||||||
WptPt pt = after.points.get(0);
|
|
||||||
float locX = tb.getPixXFromLatLon(pt.lat, pt.lon);
|
|
||||||
float locY = tb.getPixYFromLatLon(pt.lat, pt.lon);
|
|
||||||
tx.add(locX);
|
|
||||||
ty.add(locY);
|
|
||||||
}
|
|
||||||
|
|
||||||
GeometryWay.calculatePath(tb, tx, ty, path);
|
|
||||||
canvas.drawPath(path, lineAttrs.paint);
|
|
||||||
}
|
}
|
||||||
|
if (afterPoints.size() > 0) {
|
||||||
List<WptPt> points = new ArrayList<>();
|
drawPointIcon(canvas, tb, afterPoints.get(0));
|
||||||
points.addAll(editingCtx.getBeforePoints());
|
|
||||||
points.addAll(editingCtx.getAfterPoints());
|
|
||||||
overlapped = false;
|
|
||||||
int drawn = 0;
|
|
||||||
for (int i = 0; i < points.size(); i++) {
|
|
||||||
WptPt pt = points.get(i);
|
|
||||||
float locX = tb.getPixXFromLatLon(pt.lat, pt.lon);
|
|
||||||
float locY = tb.getPixYFromLatLon(pt.lat, pt.lon);
|
|
||||||
if (locX >= 0 && locX <= tb.getPixWidth() && locY >= 0 && locY <= tb.getPixHeight()) {
|
|
||||||
drawn++;
|
|
||||||
if (drawn > POINTS_TO_DRAW) {
|
|
||||||
overlapped = true;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (overlapped) {
|
|
||||||
WptPt pt = points.get(0);
|
|
||||||
float locX = tb.getPixXFromLatLon(pt.lat, pt.lon);
|
|
||||||
float locY = tb.getPixYFromLatLon(pt.lat, pt.lon);
|
|
||||||
if (locX >= 0 && locX <= tb.getPixWidth() && locY >= 0 && locY <= tb.getPixHeight()) {
|
|
||||||
canvas.drawBitmap(pointIcon, locX - marginPointIconX, locY - marginPointIconY, bitmapPaint);
|
|
||||||
}
|
|
||||||
pt = points.get(points.size() - 1);
|
|
||||||
locX = tb.getPixXFromLatLon(pt.lat, pt.lon);
|
|
||||||
locY = tb.getPixYFromLatLon(pt.lat, pt.lon);
|
|
||||||
if (locX >= 0 && locX <= tb.getPixWidth() && locY >= 0 && locY <= tb.getPixHeight()) {
|
|
||||||
canvas.drawBitmap(pointIcon, locX - marginPointIconX, locY - marginPointIconY, bitmapPaint);
|
|
||||||
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
for (int i = 0; i < points.size(); i++) {
|
|
||||||
WptPt pt = points.get(i);
|
|
||||||
float locX = tb.getPixXFromLatLon(pt.lat, pt.lon);
|
|
||||||
float locY = tb.getPixYFromLatLon(pt.lat, pt.lon);
|
|
||||||
if (locX >= 0 && locX <= tb.getPixWidth() && locY >= 0 && locY <= tb.getPixHeight()) {
|
|
||||||
canvas.drawBitmap(pointIcon, locX - marginPointIconX, locY - marginPointIconY, bitmapPaint);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (editingCtx.getSelectedPointPosition() != -1) {
|
if (editingCtx.getSelectedPointPosition() != -1) {
|
||||||
|
canvas.rotate(-tb.getRotate(), tb.getCenterPixelX(), tb.getCenterPixelY());
|
||||||
int locX = tb.getCenterPixelX();
|
int locX = tb.getCenterPixelX();
|
||||||
int locY = tb.getCenterPixelY();
|
int locY = tb.getCenterPixelY();
|
||||||
canvas.drawBitmap(applyingPointIcon, locX - marginApplyingPointIconX, locY - marginApplyingPointIconY, bitmapPaint);
|
canvas.drawBitmap(applyingPointIcon, locX - marginApplyingPointIconX, locY - marginApplyingPointIconY, bitmapPaint);
|
||||||
|
canvas.rotate(tb.getRotate(), tb.getCenterPixelX(), tb.getCenterPixelY());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private boolean isInTileBox(RotatedTileBox tb, WptPt point) {
|
||||||
|
QuadRect latLonBounds = tb.getLatLonBounds();
|
||||||
|
return point.getLatitude() >= latLonBounds.bottom && point.getLatitude() <= latLonBounds.top
|
||||||
|
&& point.getLongitude() >= latLonBounds.left && point.getLongitude() <= latLonBounds.right;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void drawPoints(Canvas canvas, RotatedTileBox tb) {
|
||||||
|
canvas.rotate(-tb.getRotate(), tb.getCenterPixelX(), tb.getCenterPixelY());
|
||||||
|
|
||||||
|
WptPt lastBeforePoint = null;
|
||||||
|
List<WptPt> points = new ArrayList<>(editingCtx.getBeforePoints());
|
||||||
|
if (points.size() > 0) {
|
||||||
|
lastBeforePoint = points.get(points.size() - 1);
|
||||||
|
}
|
||||||
|
WptPt firstAfterPoint = null;
|
||||||
|
List<WptPt> afterPoints = editingCtx.getAfterPoints();
|
||||||
|
if (afterPoints.size() > 0) {
|
||||||
|
firstAfterPoint = afterPoints.get(0);
|
||||||
|
}
|
||||||
|
points.addAll(afterPoints);
|
||||||
|
overlapped = false;
|
||||||
|
int drawn = 0;
|
||||||
|
for (int i = 0; i < points.size(); i++) {
|
||||||
|
WptPt pt = points.get(i);
|
||||||
|
if (tb.containsLatLon(pt.lat, pt.lon)) {
|
||||||
|
drawn++;
|
||||||
|
if (drawn > POINTS_TO_DRAW) {
|
||||||
|
overlapped = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (overlapped) {
|
||||||
|
WptPt pt = points.get(0);
|
||||||
|
if (pt != lastBeforePoint && pt != firstAfterPoint && isInTileBox(tb, pt)) {
|
||||||
|
float locX = tb.getPixXFromLatLon(pt.lat, pt.lon);
|
||||||
|
float locY = tb.getPixYFromLatLon(pt.lat, pt.lon);
|
||||||
|
canvas.drawBitmap(pointIcon, locX - marginPointIconX, locY - marginPointIconY, bitmapPaint);
|
||||||
|
}
|
||||||
|
pt = points.get(points.size() - 1);
|
||||||
|
if (pt != lastBeforePoint && pt != firstAfterPoint && isInTileBox(tb, pt)) {
|
||||||
|
float locX = tb.getPixXFromLatLon(pt.lat, pt.lon);
|
||||||
|
float locY = tb.getPixYFromLatLon(pt.lat, pt.lon);
|
||||||
|
canvas.drawBitmap(pointIcon, locX - marginPointIconX, locY - marginPointIconY, bitmapPaint);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
for (int i = 0; i < points.size(); i++) {
|
||||||
|
WptPt pt = points.get(i);
|
||||||
|
if (pt != lastBeforePoint && pt != firstAfterPoint && isInTileBox(tb, pt)) {
|
||||||
|
float locX = tb.getPixXFromLatLon(pt.lat, pt.lon);
|
||||||
|
float locY = tb.getPixYFromLatLon(pt.lat, pt.lon);
|
||||||
|
canvas.drawBitmap(pointIcon, locX - marginPointIconX, locY - marginPointIconY, bitmapPaint);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
canvas.rotate(tb.getRotate(), tb.getCenterPixelX(), tb.getCenterPixelY());
|
||||||
|
}
|
||||||
|
|
||||||
|
private void drawBeforeAfterPath(Canvas canvas, RotatedTileBox tb) {
|
||||||
|
TrkSegment before = editingCtx.getBeforeTrkSegmentLine();
|
||||||
|
TrkSegment after = editingCtx.getAfterTrkSegmentLine();
|
||||||
|
if (before.points.size() > 0 || after.points.size() > 0) {
|
||||||
|
path.reset();
|
||||||
|
tx.clear();
|
||||||
|
ty.clear();
|
||||||
|
|
||||||
|
if (before.points.size() > 0) {
|
||||||
|
WptPt pt = before.points.get(before.points.size() - 1);
|
||||||
|
float locX = tb.getPixXFromLatLon(pt.lat, pt.lon);
|
||||||
|
float locY = tb.getPixYFromLatLon(pt.lat, pt.lon);
|
||||||
|
tx.add(locX);
|
||||||
|
ty.add(locY);
|
||||||
|
tx.add((float) tb.getCenterPixelX());
|
||||||
|
ty.add((float) tb.getCenterPixelY());
|
||||||
|
}
|
||||||
|
if (after.points.size() > 0) {
|
||||||
|
if (before.points.size() == 0) {
|
||||||
|
tx.add((float) tb.getCenterPixelX());
|
||||||
|
ty.add((float) tb.getCenterPixelY());
|
||||||
|
}
|
||||||
|
WptPt pt = after.points.get(0);
|
||||||
|
float locX = tb.getPixXFromLatLon(pt.lat, pt.lon);
|
||||||
|
float locY = tb.getPixYFromLatLon(pt.lat, pt.lon);
|
||||||
|
tx.add(locX);
|
||||||
|
ty.add(locY);
|
||||||
}
|
}
|
||||||
|
|
||||||
canvas.rotate(tb.getRotate(), tb.getCenterPixelX(), tb.getCenterPixelY());
|
GeometryWay.calculatePath(tb, tx, ty, path);
|
||||||
|
canvas.drawPath(path, lineAttrs.paint);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -298,6 +326,16 @@ public class MeasurementToolLayer extends OsmandMapLayer implements ContextMenuL
|
||||||
canvas.rotate(tb.getRotate(), tb.getCenterPixelX(), tb.getCenterPixelY());
|
canvas.rotate(tb.getRotate(), tb.getCenterPixelX(), tb.getCenterPixelY());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void drawPointIcon(Canvas canvas, RotatedTileBox tb, WptPt pt) {
|
||||||
|
canvas.rotate(-tb.getRotate(), tb.getCenterPixelX(), tb.getCenterPixelY());
|
||||||
|
float locX = tb.getPixXFromLatLon(pt.lat, pt.lon);
|
||||||
|
float locY = tb.getPixYFromLatLon(pt.lat, pt.lon);
|
||||||
|
if (tb.containsPoint(locX, locY, 0)) {
|
||||||
|
canvas.drawBitmap(pointIcon, locX - marginPointIconX, locY - marginPointIconY, bitmapPaint);
|
||||||
|
}
|
||||||
|
canvas.rotate(tb.getRotate(), tb.getCenterPixelX(), tb.getCenterPixelY());
|
||||||
|
}
|
||||||
|
|
||||||
public WptPt addCenterPoint() {
|
public WptPt addCenterPoint() {
|
||||||
RotatedTileBox tb = view.getCurrentRotatedTileBox();
|
RotatedTileBox tb = view.getCurrentRotatedTileBox();
|
||||||
LatLon l = tb.getCenterLatLon();
|
LatLon l = tb.getCenterLatLon();
|
||||||
|
|
|
@ -1500,16 +1500,11 @@ public class AvailableGPXFragment extends OsmandExpandableListFragment implement
|
||||||
new View.OnClickListener() {
|
new View.OnClickListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onClick(View v) {
|
public void onClick(View v) {
|
||||||
final SelectedGpxFile selectedGpxFile = selectedGpxHelper.getSelectedFileByPath(gpxInfo.file.getPath());
|
|
||||||
FileUtils.renameFile(getActivity(), gpxInfo.file, new RenameCallback() {
|
FileUtils.renameFile(getActivity(), gpxInfo.file, new RenameCallback() {
|
||||||
@Override
|
@Override
|
||||||
public void renamedTo(File file) {
|
public void renamedTo(File file) {
|
||||||
asyncLoader = new LoadGpxTask();
|
asyncLoader = new LoadGpxTask();
|
||||||
asyncLoader.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR, getActivity());
|
asyncLoader.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR, getActivity());
|
||||||
if (selectedGpxFile != null && selectedGpxFile.getGpxFile() != null) {
|
|
||||||
selectedGpxFile.getGpxFile().path = file.getPath();
|
|
||||||
selectedGpxHelper.updateSelectedGpxFile(selectedGpxFile);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
@ -1263,13 +1263,12 @@ public class RoutingHelper {
|
||||||
public void run() {
|
public void run() {
|
||||||
RouteCalculationProgress calculationProgress = params.calculationProgress;
|
RouteCalculationProgress calculationProgress = params.calculationProgress;
|
||||||
if (isRouteBeingCalculated()) {
|
if (isRouteBeingCalculated()) {
|
||||||
float pr = calculationProgress.getLinearProgress();
|
|
||||||
progressRoute.updateProgress((int) pr);
|
|
||||||
Thread t = currentRunningJob;
|
Thread t = currentRunningJob;
|
||||||
if(t instanceof RouteRecalculationThread && ((RouteRecalculationThread) t).params != params) {
|
if(t instanceof RouteRecalculationThread && ((RouteRecalculationThread) t).params != params) {
|
||||||
// different calculation started
|
// different calculation started
|
||||||
return;
|
return;
|
||||||
} else {
|
} else {
|
||||||
|
progressRoute.updateProgress((int) calculationProgress.getLinearProgress());
|
||||||
if (calculationProgress.requestPrivateAccessRouting) {
|
if (calculationProgress.requestPrivateAccessRouting) {
|
||||||
progressRoute.requestPrivateAccessRouting();
|
progressRoute.requestPrivateAccessRouting();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue