Fix drawing and rename recreateSegments to splitSegments
This commit is contained in:
parent
ca6c91e995
commit
520aed2ede
3 changed files with 12 additions and 7 deletions
|
@ -191,7 +191,7 @@ public class MeasurementEditingContext {
|
||||||
after = new TrkSegment();
|
after = new TrkSegment();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void recreateSegments(int position) {
|
public void splitSegments(int position) {
|
||||||
before = new TrkSegment();
|
before = new TrkSegment();
|
||||||
before.points.addAll(measurementPoints.subList(0, position));
|
before.points.addAll(measurementPoints.subList(0, position));
|
||||||
addBeforeRenders();
|
addBeforeRenders();
|
||||||
|
|
|
@ -607,7 +607,7 @@ public class MeasurementToolFragment extends Fragment {
|
||||||
public void moveOnClick() {
|
public void moveOnClick() {
|
||||||
if (measurementLayer != null) {
|
if (measurementLayer != null) {
|
||||||
measurementLayer.enterMovingPointMode();
|
measurementLayer.enterMovingPointMode();
|
||||||
editingCtx.recreateSegments(editingCtx.getSelectedPointPosition());
|
editingCtx.splitSegments(editingCtx.getSelectedPointPosition());
|
||||||
}
|
}
|
||||||
switchMovePointMode(true);
|
switchMovePointMode(true);
|
||||||
}
|
}
|
||||||
|
@ -624,7 +624,7 @@ public class MeasurementToolFragment extends Fragment {
|
||||||
public void addPointAfterOnClick() {
|
public void addPointAfterOnClick() {
|
||||||
if (measurementLayer != null) {
|
if (measurementLayer != null) {
|
||||||
editingCtx.setSelectedPointPosition(editingCtx.getSelectedPointPosition() + 1);
|
editingCtx.setSelectedPointPosition(editingCtx.getSelectedPointPosition() + 1);
|
||||||
editingCtx.recreateSegments(editingCtx.getSelectedPointPosition());
|
editingCtx.splitSegments(editingCtx.getSelectedPointPosition());
|
||||||
measurementLayer.enterAddingPointAfterMode();
|
measurementLayer.enterAddingPointAfterMode();
|
||||||
}
|
}
|
||||||
switchAddPointAfterMode(true);
|
switchAddPointAfterMode(true);
|
||||||
|
@ -633,7 +633,7 @@ public class MeasurementToolFragment extends Fragment {
|
||||||
@Override
|
@Override
|
||||||
public void addPointBeforeOnClick() {
|
public void addPointBeforeOnClick() {
|
||||||
if (measurementLayer != null) {
|
if (measurementLayer != null) {
|
||||||
editingCtx.recreateSegments(editingCtx.getSelectedPointPosition());
|
editingCtx.splitSegments(editingCtx.getSelectedPointPosition());
|
||||||
measurementLayer.enterAddingPointBeforeMode();
|
measurementLayer.enterAddingPointBeforeMode();
|
||||||
}
|
}
|
||||||
switchAddPointBeforeMode(true);
|
switchAddPointBeforeMode(true);
|
||||||
|
@ -884,7 +884,7 @@ public class MeasurementToolFragment extends Fragment {
|
||||||
if (measurementLayer != null) {
|
if (measurementLayer != null) {
|
||||||
if (addPointToPosition(editingCtx.getSelectedPointPosition())) {
|
if (addPointToPosition(editingCtx.getSelectedPointPosition())) {
|
||||||
editingCtx.setSelectedPointPosition(editingCtx.getSelectedPointPosition() + 1);
|
editingCtx.setSelectedPointPosition(editingCtx.getSelectedPointPosition() + 1);
|
||||||
editingCtx.recreateSegments(editingCtx.getSelectedPointPosition());
|
editingCtx.splitSegments(editingCtx.getSelectedPointPosition());
|
||||||
measurementLayer.refreshMap();
|
measurementLayer.refreshMap();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -916,7 +916,7 @@ public class MeasurementToolFragment extends Fragment {
|
||||||
MeasurementToolLayer measurementLayer = getMeasurementLayer();
|
MeasurementToolLayer measurementLayer = getMeasurementLayer();
|
||||||
if (measurementLayer != null) {
|
if (measurementLayer != null) {
|
||||||
if (addPointToPosition(editingCtx.getSelectedPointPosition())) {
|
if (addPointToPosition(editingCtx.getSelectedPointPosition())) {
|
||||||
editingCtx.recreateSegments(editingCtx.getSelectedPointPosition());
|
editingCtx.splitSegments(editingCtx.getSelectedPointPosition());
|
||||||
measurementLayer.refreshMap();
|
measurementLayer.refreshMap();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1040,7 +1040,7 @@ public class MeasurementToolFragment extends Fragment {
|
||||||
MeasurementToolLayer measurementLayer = getMeasurementLayer();
|
MeasurementToolLayer measurementLayer = getMeasurementLayer();
|
||||||
if (measurementLayer != null) {
|
if (measurementLayer != null) {
|
||||||
added = commandManager.execute(new AddPointCommand(measurementLayer, position));
|
added = commandManager.execute(new AddPointCommand(measurementLayer, position));
|
||||||
editingCtx.recreateSegments(position);
|
editingCtx.splitSegments(position);
|
||||||
doAddOrMovePointCommonStuff();
|
doAddOrMovePointCommonStuff();
|
||||||
}
|
}
|
||||||
return added;
|
return added;
|
||||||
|
|
|
@ -249,6 +249,11 @@ public class MeasurementToolLayer extends OsmandMapLayer implements ContextMenuL
|
||||||
ty.add(tb.getCenterPixelY());
|
ty.add(tb.getCenterPixelY());
|
||||||
}
|
}
|
||||||
if (after.points.size() > 0) {
|
if (after.points.size() > 0) {
|
||||||
|
if (before.points.size() == 0) {
|
||||||
|
path.moveTo(tb.getCenterPixelX(), tb.getCenterPixelY());
|
||||||
|
tx.add(tb.getCenterPixelX());
|
||||||
|
ty.add(tb.getCenterPixelY());
|
||||||
|
}
|
||||||
WptPt pt = after.points.get(0);
|
WptPt pt = after.points.get(0);
|
||||||
int locX = tb.getPixXFromLonNoRot(pt.lon);
|
int locX = tb.getPixXFromLonNoRot(pt.lon);
|
||||||
int locY = tb.getPixYFromLatNoRot(pt.lat);
|
int locY = tb.getPixYFromLatNoRot(pt.lat);
|
||||||
|
|
Loading…
Reference in a new issue