Fix points
This commit is contained in:
parent
bec3c71a66
commit
7aadcc8f75
2 changed files with 7 additions and 10 deletions
|
@ -608,7 +608,7 @@ public class MeasurementToolFragment extends Fragment {
|
||||||
if (measurementLayer != null) {
|
if (measurementLayer != null) {
|
||||||
editingCtx.setSelectedPointPosition(editingCtx.getSelectedPointPosition() + 1);
|
editingCtx.setSelectedPointPosition(editingCtx.getSelectedPointPosition() + 1);
|
||||||
editingCtx.splitSegments(editingCtx.getSelectedPointPosition());
|
editingCtx.splitSegments(editingCtx.getSelectedPointPosition());
|
||||||
measurementLayer.enterAddingPointAfterMode();
|
measurementLayer.enterAddingPointBeforeAfterMode();
|
||||||
}
|
}
|
||||||
((TextView) mainView.findViewById(R.id.add_point_before_after_text)).setText(mainView.getResources().getString(R.string.add_point_after));
|
((TextView) mainView.findViewById(R.id.add_point_before_after_text)).setText(mainView.getResources().getString(R.string.add_point_after));
|
||||||
switchAddPointBeforeAfterMode(true);
|
switchAddPointBeforeAfterMode(true);
|
||||||
|
@ -618,7 +618,7 @@ public class MeasurementToolFragment extends Fragment {
|
||||||
public void addPointBeforeOnClick() {
|
public void addPointBeforeOnClick() {
|
||||||
if (measurementLayer != null) {
|
if (measurementLayer != null) {
|
||||||
editingCtx.splitSegments(editingCtx.getSelectedPointPosition());
|
editingCtx.splitSegments(editingCtx.getSelectedPointPosition());
|
||||||
measurementLayer.enterAddingPointBeforeMode();
|
measurementLayer.enterAddingPointBeforeAfterMode();
|
||||||
}
|
}
|
||||||
((TextView) mainView.findViewById(R.id.add_point_before_after_text)).setText(mainView.getResources().getString(R.string.add_point_before));
|
((TextView) mainView.findViewById(R.id.add_point_before_after_text)).setText(mainView.getResources().getString(R.string.add_point_before));
|
||||||
switchAddPointBeforeAfterMode(true);
|
switchAddPointBeforeAfterMode(true);
|
||||||
|
@ -842,8 +842,9 @@ public class MeasurementToolFragment extends Fragment {
|
||||||
WptPt oldPoint = editingCtx.getOriginalPointToMove();
|
WptPt oldPoint = editingCtx.getOriginalPointToMove();
|
||||||
int position = editingCtx.getSelectedPointPosition();
|
int position = editingCtx.getSelectedPointPosition();
|
||||||
editingCtx.getCommandManager().execute(new MovePointCommand(measurementLayer, oldPoint, newPoint, position));
|
editingCtx.getCommandManager().execute(new MovePointCommand(measurementLayer, oldPoint, newPoint, position));
|
||||||
doAddOrMovePointCommonStuff();
|
editingCtx.addPoint(newPoint);
|
||||||
measurementLayer.exitMovePointMode(false);
|
measurementLayer.exitMovePointMode(false);
|
||||||
|
doAddOrMovePointCommonStuff();
|
||||||
measurementLayer.refreshMap();
|
measurementLayer.refreshMap();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -862,7 +863,6 @@ public class MeasurementToolFragment extends Fragment {
|
||||||
if (measurementLayer != null) {
|
if (measurementLayer != null) {
|
||||||
if (addPointToPosition(editingCtx.getPointsCount())) {
|
if (addPointToPosition(editingCtx.getPointsCount())) {
|
||||||
editingCtx.setSelectedPointPosition(editingCtx.getPointsCount());
|
editingCtx.setSelectedPointPosition(editingCtx.getPointsCount());
|
||||||
editingCtx.splitSegments(editingCtx.getSelectedPointPosition());
|
|
||||||
measurementLayer.refreshMap();
|
measurementLayer.refreshMap();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -870,11 +870,13 @@ public class MeasurementToolFragment extends Fragment {
|
||||||
|
|
||||||
private void applyAddPointBeforeOrAfterMode() {
|
private void applyAddPointBeforeOrAfterMode() {
|
||||||
switchAddPointAfterMode(false);
|
switchAddPointAfterMode(false);
|
||||||
|
editingCtx.splitSegments(editingCtx.getBeforePoints().size() + editingCtx.getAfterPoints().size());
|
||||||
editingCtx.setSelectedPointPosition(-1);
|
editingCtx.setSelectedPointPosition(-1);
|
||||||
MeasurementToolLayer measurementLayer = getMeasurementLayer();
|
MeasurementToolLayer measurementLayer = getMeasurementLayer();
|
||||||
if (measurementLayer != null) {
|
if (measurementLayer != null) {
|
||||||
measurementLayer.refreshMap();
|
measurementLayer.refreshMap();
|
||||||
}
|
}
|
||||||
|
updateText();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void cancelAddPointBeforeOrAfterMode() {
|
private void cancelAddPointBeforeOrAfterMode() {
|
||||||
|
@ -973,7 +975,6 @@ public class MeasurementToolFragment extends Fragment {
|
||||||
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, position));
|
||||||
editingCtx.splitSegments(position);
|
|
||||||
doAddOrMovePointCommonStuff();
|
doAddOrMovePointCommonStuff();
|
||||||
}
|
}
|
||||||
return added;
|
return added;
|
||||||
|
|
|
@ -151,11 +151,7 @@ public class MeasurementToolLayer extends OsmandMapLayer implements ContextMenuL
|
||||||
editingCtx.splitSegments(editingCtx.getSelectedPointPosition());
|
editingCtx.splitSegments(editingCtx.getSelectedPointPosition());
|
||||||
}
|
}
|
||||||
|
|
||||||
void enterAddingPointAfterMode() {
|
void enterAddingPointBeforeAfterMode() {
|
||||||
moveMapToPoint(editingCtx.getSelectedPointPosition() - 1);
|
|
||||||
}
|
|
||||||
|
|
||||||
void enterAddingPointBeforeMode() {
|
|
||||||
moveMapToPoint(editingCtx.getSelectedPointPosition());
|
moveMapToPoint(editingCtx.getSelectedPointPosition());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue