Remove snappedToRoadPoints from layer
This commit is contained in:
parent
2871edbb55
commit
9a3cafc431
3 changed files with 6 additions and 23 deletions
|
@ -20,7 +20,6 @@ import net.osmand.plus.views.OsmandMapLayer;
|
||||||
import net.osmand.plus.views.OsmandMapTileView;
|
import net.osmand.plus.views.OsmandMapTileView;
|
||||||
import net.osmand.util.MapUtils;
|
import net.osmand.util.MapUtils;
|
||||||
|
|
||||||
import java.util.LinkedList;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import gnu.trove.list.array.TIntArrayList;
|
import gnu.trove.list.array.TIntArrayList;
|
||||||
|
@ -29,7 +28,6 @@ public class MeasurementToolLayer extends OsmandMapLayer implements ContextMenuL
|
||||||
|
|
||||||
private OsmandMapTileView view;
|
private OsmandMapTileView view;
|
||||||
private boolean inMeasurementMode;
|
private boolean inMeasurementMode;
|
||||||
private List<WptPt> snappedToRoadPoints = new LinkedList<>();
|
|
||||||
private Bitmap centerIconDay;
|
private Bitmap centerIconDay;
|
||||||
private Bitmap centerIconNight;
|
private Bitmap centerIconNight;
|
||||||
private Bitmap pointIcon;
|
private Bitmap pointIcon;
|
||||||
|
@ -118,10 +116,6 @@ public class MeasurementToolLayer extends OsmandMapLayer implements ContextMenuL
|
||||||
this.inMeasurementMode = inMeasurementMode;
|
this.inMeasurementMode = inMeasurementMode;
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<WptPt> getSnappedToRoadPoints() {
|
|
||||||
return snappedToRoadPoints;
|
|
||||||
}
|
|
||||||
|
|
||||||
String getDistanceSt() {
|
String getDistanceSt() {
|
||||||
float dist = 0;
|
float dist = 0;
|
||||||
List<WptPt> measurementPoints = editingCtx.getPoints();
|
List<WptPt> measurementPoints = editingCtx.getPoints();
|
||||||
|
@ -255,12 +249,7 @@ public class MeasurementToolLayer extends OsmandMapLayer implements ContextMenuL
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
List<WptPt> drawPoints;
|
List<WptPt> drawPoints = editingCtx.getPoints();
|
||||||
if (snappedToRoadPoints.size() > 0) {
|
|
||||||
drawPoints = snappedToRoadPoints;
|
|
||||||
} else {
|
|
||||||
drawPoints = editingCtx.getPoints();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (drawPoints.size() > 0) {
|
if (drawPoints.size() > 0) {
|
||||||
path.reset();
|
path.reset();
|
||||||
|
|
|
@ -9,7 +9,6 @@ import java.util.List;
|
||||||
public class ClearPointsCommand extends MeasurementModeCommand {
|
public class ClearPointsCommand extends MeasurementModeCommand {
|
||||||
|
|
||||||
private List<WptPt> points;
|
private List<WptPt> points;
|
||||||
private List<WptPt> snappedToRoadPoints;
|
|
||||||
|
|
||||||
public ClearPointsCommand(MeasurementToolLayer measurementLayer) {
|
public ClearPointsCommand(MeasurementToolLayer measurementLayer) {
|
||||||
this.measurementLayer = measurementLayer;
|
this.measurementLayer = measurementLayer;
|
||||||
|
@ -18,11 +17,8 @@ public class ClearPointsCommand extends MeasurementModeCommand {
|
||||||
@Override
|
@Override
|
||||||
public boolean execute() {
|
public boolean execute() {
|
||||||
List<WptPt> pts = measurementLayer.getEditingCtx().getPoints();
|
List<WptPt> pts = measurementLayer.getEditingCtx().getPoints();
|
||||||
List<WptPt> snappedPts = measurementLayer.getSnappedToRoadPoints();
|
|
||||||
points = new LinkedList<>(pts);
|
points = new LinkedList<>(pts);
|
||||||
snappedToRoadPoints = new LinkedList<>(snappedPts);
|
|
||||||
pts.clear();
|
pts.clear();
|
||||||
snappedPts.clear();
|
|
||||||
measurementLayer.refreshMap();
|
measurementLayer.refreshMap();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -30,14 +26,12 @@ public class ClearPointsCommand extends MeasurementModeCommand {
|
||||||
@Override
|
@Override
|
||||||
public void undo() {
|
public void undo() {
|
||||||
measurementLayer.getEditingCtx().getPoints().addAll(points);
|
measurementLayer.getEditingCtx().getPoints().addAll(points);
|
||||||
measurementLayer.getSnappedToRoadPoints().addAll(snappedToRoadPoints);
|
|
||||||
measurementLayer.refreshMap();
|
measurementLayer.refreshMap();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void redo() {
|
public void redo() {
|
||||||
measurementLayer.getEditingCtx().getPoints().clear();
|
measurementLayer.getEditingCtx().getPoints().clear();
|
||||||
measurementLayer.getSnappedToRoadPoints().clear();
|
|
||||||
measurementLayer.refreshMap();
|
measurementLayer.refreshMap();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -16,21 +16,21 @@ public class SnapToRoadCommand extends MeasurementModeCommand {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean execute() {
|
public boolean execute() {
|
||||||
measurementLayer.getSnappedToRoadPoints().clear();
|
// measurementLayer.getSnappedToRoadPoints().clear();
|
||||||
measurementLayer.getSnappedToRoadPoints().addAll(snappedPoints);
|
// measurementLayer.getSnappedToRoadPoints().addAll(snappedPoints);
|
||||||
measurementLayer.refreshMap();
|
// measurementLayer.refreshMap();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void undo() {
|
public void undo() {
|
||||||
measurementLayer.getSnappedToRoadPoints().clear();
|
// measurementLayer.getSnappedToRoadPoints().clear();
|
||||||
measurementLayer.refreshMap();
|
measurementLayer.refreshMap();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void redo() {
|
public void redo() {
|
||||||
measurementLayer.getSnappedToRoadPoints().addAll(snappedPoints);
|
// measurementLayer.getSnappedToRoadPoints().addAll(snappedPoints);
|
||||||
measurementLayer.refreshMap();
|
measurementLayer.refreshMap();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue