Remove unnecessary method

This commit is contained in:
PavelRatushnyi 2017-08-26 15:58:08 +03:00
parent c648dd2d3f
commit 0fe38dd006
2 changed files with 3 additions and 17 deletions

View file

@ -862,7 +862,7 @@ public class MeasurementToolFragment extends Fragment {
if (measurementLayer != null) { if (measurementLayer != null) {
int selectedPoint = editingCtx.getSelectedPointPosition(); //after = 1; before = 1; int selectedPoint = editingCtx.getSelectedPointPosition(); //after = 1; before = 1;
int pointsCount = editingCtx.getPointsCount(); //after = 2; before = 1; int pointsCount = editingCtx.getPointsCount(); //after = 2; before = 1;
if (addPointToPosition(editingCtx.getPointsCount())) { //выбрать вторую точку if (addCenterPoint()) { //выбрать вторую точку
if (selectedPoint == pointsCount) { if (selectedPoint == pointsCount) {
editingCtx.splitSegments(editingCtx.getPointsCount() - 1); editingCtx.splitSegments(editingCtx.getPointsCount() - 1);
} else { } else {
@ -949,19 +949,11 @@ public class MeasurementToolFragment extends Fragment {
} }
} }
private void addCenterPoint() { private boolean addCenterPoint() {
MeasurementToolLayer measurementLayer = getMeasurementLayer();
if (measurementLayer != null) {
editingCtx.getCommandManager().execute(new AddPointCommand(measurementLayer, true));
doAddOrMovePointCommonStuff();
}
}
private boolean addPointToPosition(int position) {
boolean added = false; boolean added = false;
MeasurementToolLayer measurementLayer = getMeasurementLayer(); MeasurementToolLayer measurementLayer = getMeasurementLayer();
if (measurementLayer != null) { if (measurementLayer != null) {
added = editingCtx.getCommandManager().execute(new AddPointCommand(measurementLayer, position)); added = editingCtx.getCommandManager().execute(new AddPointCommand(measurementLayer, true));
doAddOrMovePointCommonStuff(); doAddOrMovePointCommonStuff();
} }
return added; return added;

View file

@ -9,12 +9,6 @@ public class AddPointCommand extends MeasurementModeCommand {
private WptPt point; private WptPt point;
private boolean center; private boolean center;
public AddPointCommand(MeasurementToolLayer measurementLayer, int position) {
this.measurementLayer = measurementLayer;
this.center = true;
this.position = position;
}
public AddPointCommand(MeasurementToolLayer measurementLayer, boolean center) { public AddPointCommand(MeasurementToolLayer measurementLayer, boolean center) {
this.measurementLayer = measurementLayer; this.measurementLayer = measurementLayer;
this.center = center; this.center = center;