Merge branch 'sasha_pasha_branch' of ssh://github.com/osmandapp/Osmand into sasha_pasha_branch
This commit is contained in:
commit
5e3a87de0e
2 changed files with 19 additions and 21 deletions
|
@ -16,11 +16,11 @@ import net.osmand.router.RouteCalculationProgress;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.LinkedList;
|
import java.util.LinkedList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Queue;
|
import java.util.Queue;
|
||||||
|
import java.util.concurrent.ConcurrentHashMap;
|
||||||
|
|
||||||
public class MeasurementEditingContext {
|
public class MeasurementEditingContext {
|
||||||
|
|
||||||
|
@ -46,7 +46,7 @@ public class MeasurementEditingContext {
|
||||||
private ApplicationMode snapToRoadAppMode;
|
private ApplicationMode snapToRoadAppMode;
|
||||||
private RouteCalculationProgress calculationProgress;
|
private RouteCalculationProgress calculationProgress;
|
||||||
private Queue<Pair<WptPt, WptPt>> snapToRoadPairsToCalculate = new LinkedList<>();
|
private Queue<Pair<WptPt, WptPt>> snapToRoadPairsToCalculate = new LinkedList<>();
|
||||||
private Map<Pair<WptPt, WptPt>, List<WptPt>> snappedToRoadPoints = new HashMap<>();
|
private Map<Pair<WptPt, WptPt>, List<WptPt>> snappedToRoadPoints = new ConcurrentHashMap<>();
|
||||||
|
|
||||||
private List<WptPt> measurementPoints = new LinkedList<>();
|
private List<WptPt> measurementPoints = new LinkedList<>();
|
||||||
|
|
||||||
|
@ -117,11 +117,7 @@ public class MeasurementEditingContext {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setInSnapToRoadMode(boolean inSnapToRoadMode) {
|
public void setInSnapToRoadMode(boolean inSnapToRoadMode) {
|
||||||
inSnapToRoadMode = inSnapToRoadMode;
|
this.inSnapToRoadMode = inSnapToRoadMode;
|
||||||
}
|
|
||||||
|
|
||||||
public SnapToRoadProgressListener getProgressListener() {
|
|
||||||
return progressListener;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setProgressListener(SnapToRoadProgressListener progressListener) {
|
public void setProgressListener(SnapToRoadProgressListener progressListener) {
|
||||||
|
@ -136,14 +132,6 @@ public class MeasurementEditingContext {
|
||||||
this.snapToRoadAppMode = snapToRoadAppMode;
|
this.snapToRoadAppMode = snapToRoadAppMode;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Queue<Pair<WptPt, WptPt>> getSnapToRoadPairsToCalculate() {
|
|
||||||
return snapToRoadPairsToCalculate;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setSnapToRoadPairsToCalculate(Queue<Pair<WptPt, WptPt>> snapToRoadPairsToCalculate) {
|
|
||||||
this.snapToRoadPairsToCalculate = snapToRoadPairsToCalculate;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Map<Pair<WptPt, WptPt>, List<WptPt>> getSnappedPoints() {
|
public Map<Pair<WptPt, WptPt>, List<WptPt>> getSnappedPoints() {
|
||||||
return snappedToRoadPoints;
|
return snappedToRoadPoints;
|
||||||
}
|
}
|
||||||
|
@ -229,6 +217,7 @@ public class MeasurementEditingContext {
|
||||||
|
|
||||||
void cancelSnapToRoad() {
|
void cancelSnapToRoad() {
|
||||||
progressListener.hideProgressBar();
|
progressListener.hideProgressBar();
|
||||||
|
snapToRoadPairsToCalculate.clear();
|
||||||
if (calculationProgress != null) {
|
if (calculationProgress != null) {
|
||||||
calculationProgress.isCancelled = true;
|
calculationProgress.isCancelled = true;
|
||||||
}
|
}
|
||||||
|
@ -281,8 +270,6 @@ public class MeasurementEditingContext {
|
||||||
pts.add(pt);
|
pts.add(pt);
|
||||||
}
|
}
|
||||||
snappedToRoadPoints.put(currentPair, pts);
|
snappedToRoadPoints.put(currentPair, pts);
|
||||||
// todo change logic
|
|
||||||
// todo fix strange exceptions when snap to road calculates
|
|
||||||
recreateSegments();
|
recreateSegments();
|
||||||
progressListener.refreshMap();
|
progressListener.refreshMap();
|
||||||
if (!snapToRoadPairsToCalculate.isEmpty()) {
|
if (!snapToRoadPairsToCalculate.isEmpty()) {
|
||||||
|
|
|
@ -101,6 +101,7 @@ public class MeasurementToolFragment extends Fragment {
|
||||||
private ImageView mainIcon;
|
private ImageView mainIcon;
|
||||||
|
|
||||||
private boolean wasCollapseButtonVisible;
|
private boolean wasCollapseButtonVisible;
|
||||||
|
private boolean progressBarVisible;
|
||||||
private boolean pointsListOpened;
|
private boolean pointsListOpened;
|
||||||
private Boolean saved;
|
private Boolean saved;
|
||||||
private boolean portrait;
|
private boolean portrait;
|
||||||
|
@ -130,10 +131,7 @@ public class MeasurementToolFragment extends Fragment {
|
||||||
editingCtx.setProgressListener(new MeasurementEditingContext.SnapToRoadProgressListener() {
|
editingCtx.setProgressListener(new MeasurementEditingContext.SnapToRoadProgressListener() {
|
||||||
@Override
|
@Override
|
||||||
public void showProgressBar() {
|
public void showProgressBar() {
|
||||||
ProgressBar progressBar = (ProgressBar) mainView.findViewById(R.id.snap_to_road_progress_bar);
|
MeasurementToolFragment.this.showProgressBar();
|
||||||
progressBar.setVisibility(View.VISIBLE);
|
|
||||||
progressBar.setMinimumHeight(0);
|
|
||||||
progressBar.setProgress(0);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -144,6 +142,7 @@ public class MeasurementToolFragment extends Fragment {
|
||||||
@Override
|
@Override
|
||||||
public void hideProgressBar() {
|
public void hideProgressBar() {
|
||||||
((ProgressBar) mainView.findViewById(R.id.snap_to_road_progress_bar)).setVisibility(View.GONE);
|
((ProgressBar) mainView.findViewById(R.id.snap_to_road_progress_bar)).setVisibility(View.GONE);
|
||||||
|
progressBarVisible = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -201,6 +200,10 @@ public class MeasurementToolFragment extends Fragment {
|
||||||
pointsListContainer.setBackgroundColor(backgroundColor);
|
pointsListContainer.setBackgroundColor(backgroundColor);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (progressBarVisible) {
|
||||||
|
showProgressBar();
|
||||||
|
}
|
||||||
|
|
||||||
distanceTv = (TextView) mainView.findViewById(R.id.measurement_distance_text_view);
|
distanceTv = (TextView) mainView.findViewById(R.id.measurement_distance_text_view);
|
||||||
pointsTv = (TextView) mainView.findViewById(R.id.measurement_points_text_view);
|
pointsTv = (TextView) mainView.findViewById(R.id.measurement_points_text_view);
|
||||||
distanceToCenterTv = (TextView) mainView.findViewById(R.id.distance_to_center_text_view);
|
distanceToCenterTv = (TextView) mainView.findViewById(R.id.distance_to_center_text_view);
|
||||||
|
@ -521,6 +524,14 @@ public class MeasurementToolFragment extends Fragment {
|
||||||
return iconsCache.getIcon(id, nightMode ? R.color.osmand_orange : R.color.color_myloc_distance);
|
return iconsCache.getIcon(id, nightMode ? R.color.osmand_orange : R.color.color_myloc_distance);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void showProgressBar() {
|
||||||
|
ProgressBar progressBar = (ProgressBar) mainView.findViewById(R.id.snap_to_road_progress_bar);
|
||||||
|
progressBar.setVisibility(View.VISIBLE);
|
||||||
|
progressBar.setMinimumHeight(0);
|
||||||
|
progressBar.setProgress(0);
|
||||||
|
progressBarVisible = true;
|
||||||
|
}
|
||||||
|
|
||||||
private void showSnapToRoadMenu(boolean rememberPreviousTitle) {
|
private void showSnapToRoadMenu(boolean rememberPreviousTitle) {
|
||||||
MapActivity mapActivity = getMapActivity();
|
MapActivity mapActivity = getMapActivity();
|
||||||
if (mapActivity != null) {
|
if (mapActivity != null) {
|
||||||
|
|
Loading…
Reference in a new issue