Optimise snap to road
This commit is contained in:
parent
77cbb79deb
commit
154dc2b1c4
5 changed files with 10 additions and 8 deletions
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
@ -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());
|
||||
}
|
||||
|
|
|
@ -28,7 +28,7 @@ public class AddPointCommand extends MeasurementModeCommand {
|
|||
|
||||
@Override
|
||||
public void undo() {
|
||||
measurementLayer.getEditingCtx().removePoint(position);
|
||||
measurementLayer.getEditingCtx().removePoint(position, true);
|
||||
measurementLayer.refreshMap();
|
||||
}
|
||||
|
||||
|
|
|
@ -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();
|
||||
}
|
||||
|
|
|
@ -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();
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue