Optimise snap to road

This commit is contained in:
Alex 2017-08-27 22:13:04 +03:00
parent 77cbb79deb
commit 154dc2b1c4
5 changed files with 10 additions and 8 deletions

View file

@ -167,9 +167,11 @@ public class MeasurementEditingContext {
updateCacheForSnapIfNeeded(false);
}
public WptPt removePoint(int position) {
public WptPt removePoint(int position, boolean updateSnapToRoad) {
WptPt pt = before.points.remove(position);
updateCacheForSnapIfNeeded(false);
if (updateSnapToRoad) {
updateCacheForSnapIfNeeded(false);
}
return pt;
}

View file

@ -146,7 +146,7 @@ public class MeasurementToolLayer extends OsmandMapLayer implements ContextMenuL
void enterMovingPointMode() {
moveMapToPoint(editingCtx.getSelectedPointPosition());
WptPt pt = editingCtx.removePoint(editingCtx.getSelectedPointPosition());
WptPt pt = editingCtx.removePoint(editingCtx.getSelectedPointPosition(), false);
editingCtx.setOriginalPointToMove(pt);
editingCtx.splitSegments(editingCtx.getSelectedPointPosition());
}

View file

@ -28,7 +28,7 @@ public class AddPointCommand extends MeasurementModeCommand {
@Override
public void undo() {
measurementLayer.getEditingCtx().removePoint(position);
measurementLayer.getEditingCtx().removePoint(position, true);
measurementLayer.refreshMap();
}

View file

@ -23,14 +23,14 @@ public class MovePointCommand extends MeasurementModeCommand {
@Override
public void undo() {
measurementLayer.getEditingCtx().removePoint(position);
measurementLayer.getEditingCtx().removePoint(position, false);
measurementLayer.getEditingCtx().addPoint(position, oldPoint);
measurementLayer.refreshMap();
}
@Override
public void redo() {
measurementLayer.getEditingCtx().removePoint(position);
measurementLayer.getEditingCtx().removePoint(position, false);
measurementLayer.getEditingCtx().addPoint(position, newPoint);
measurementLayer.refreshMap();
}

View file

@ -15,7 +15,7 @@ public class RemovePointCommand extends MeasurementModeCommand {
@Override
public boolean execute() {
point = measurementLayer.getEditingCtx().removePoint(position);
point = measurementLayer.getEditingCtx().removePoint(position, true);
measurementLayer.refreshMap();
return true;
}
@ -29,7 +29,7 @@ public class RemovePointCommand extends MeasurementModeCommand {
@Override
public void redo() {
measurementLayer.getEditingCtx().removePoint(position);
measurementLayer.getEditingCtx().removePoint(position, true);
measurementLayer.refreshMap();
}