Merge branch 'master' of ssh://github.com/osmandapp/Osmand
This commit is contained in:
commit
acd63b40e0
10 changed files with 239 additions and 57 deletions
BIN
OsmAnd/res/drawable-hdpi/ic_signpost.png
Normal file
BIN
OsmAnd/res/drawable-hdpi/ic_signpost.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 398 B |
BIN
OsmAnd/res/drawable-large/ic_signpost.png
Normal file
BIN
OsmAnd/res/drawable-large/ic_signpost.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 460 B |
BIN
OsmAnd/res/drawable-mdpi/ic_signpost.png
Normal file
BIN
OsmAnd/res/drawable-mdpi/ic_signpost.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 314 B |
BIN
OsmAnd/res/drawable-xhdpi/ic_signpost.png
Normal file
BIN
OsmAnd/res/drawable-xhdpi/ic_signpost.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 440 B |
BIN
OsmAnd/res/drawable-xxhdpi/ic_signpost.png
Normal file
BIN
OsmAnd/res/drawable-xxhdpi/ic_signpost.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 704 B |
|
@ -24,7 +24,8 @@
|
||||||
<ListView android:id="@android:id/list"
|
<ListView android:id="@android:id/list"
|
||||||
android:layout_width="fill_parent"
|
android:layout_width="fill_parent"
|
||||||
android:layout_height="fill_parent"
|
android:layout_height="fill_parent"
|
||||||
style="@style/OsmandListView"/>
|
android:choiceMode="singleChoice"
|
||||||
|
style="@style/OsmandListView"/>
|
||||||
|
|
||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
|
@ -8,6 +8,7 @@
|
||||||
<string name="mark_as_visited">Mark as visited</string>
|
<string name="mark_as_visited">Mark as visited</string>
|
||||||
<string name="mark_as_not_visited">Mark as not-visited</string>
|
<string name="mark_as_not_visited">Mark as not-visited</string>
|
||||||
<string name="mark_as_current">Navigate to</string>
|
<string name="mark_as_current">Navigate to</string>
|
||||||
|
<string name="navigate_to_next">Navigate to next point</string>
|
||||||
<string name="map_widget_route_points">Route points</string>
|
<string name="map_widget_route_points">Route points</string>
|
||||||
<string name="route_points_activity">Route Points</string>
|
<string name="route_points_activity">Route Points</string>
|
||||||
<string name="navigate_dialog">Navigate dialog</string>
|
<string name="navigate_dialog">Navigate dialog</string>
|
||||||
|
|
|
@ -132,6 +132,7 @@ public class RoutePointsActivity extends OsmandListActivity {
|
||||||
super.onListItemClick(l, v, position, id);
|
super.onListItemClick(l, v, position, id);
|
||||||
RoutePoint rp = adapter.getItem(position);
|
RoutePoint rp = adapter.getItem(position);
|
||||||
getSherlock().startActionMode(getPointActionModeCallback(rp));
|
getSherlock().startActionMode(getPointActionModeCallback(rp));
|
||||||
|
adapter.notifyDataSetChanged();
|
||||||
}
|
}
|
||||||
|
|
||||||
private class PointItemAdapter extends ArrayAdapter<RoutePoint> {
|
private class PointItemAdapter extends ArrayAdapter<RoutePoint> {
|
||||||
|
@ -262,6 +263,7 @@ public class RoutePointsActivity extends OsmandListActivity {
|
||||||
@Override
|
@Override
|
||||||
public void onDestroyActionMode(ActionMode actionMode) {
|
public void onDestroyActionMode(ActionMode actionMode) {
|
||||||
selectedItem = null;
|
selectedItem = null;
|
||||||
|
adapter.notifyDataSetChanged();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,135 @@
|
||||||
|
package net.osmand.plus.routepointsnavigation;
|
||||||
|
|
||||||
|
import android.content.DialogInterface;
|
||||||
|
import android.graphics.Canvas;
|
||||||
|
import android.graphics.PointF;
|
||||||
|
import android.os.AsyncTask;
|
||||||
|
import net.osmand.data.LatLon;
|
||||||
|
import net.osmand.data.RotatedTileBox;
|
||||||
|
import net.osmand.plus.ContextMenuAdapter;
|
||||||
|
import net.osmand.plus.GPXUtilities;
|
||||||
|
import net.osmand.plus.R;
|
||||||
|
import net.osmand.plus.activities.MapActivity;
|
||||||
|
import net.osmand.plus.views.ContextMenuLayer;
|
||||||
|
import net.osmand.plus.views.OsmandMapLayer;
|
||||||
|
import net.osmand.plus.views.OsmandMapTileView;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Created by Barsik on 20.06.2014.
|
||||||
|
*/
|
||||||
|
public class RoutePointsLayer extends OsmandMapLayer implements ContextMenuLayer.IContextMenuProvider {
|
||||||
|
|
||||||
|
private final RoutePointsPlugin plugin;
|
||||||
|
private final MapActivity map;
|
||||||
|
|
||||||
|
public RoutePointsLayer(MapActivity map, RoutePointsPlugin plugin){
|
||||||
|
this.map = map;
|
||||||
|
this.plugin = plugin;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void collectObjectsFromPoint(PointF point, RotatedTileBox tileBox, List<Object> o) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public LatLon getObjectLocation(Object o) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getObjectDescription(Object o) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getObjectName(Object o) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void initLayer(OsmandMapTileView view) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onDraw(Canvas canvas, RotatedTileBox tileBox, DrawSettings settings) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void destroyLayer() {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean drawInScreenPixels() {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void populateObjectContextMenu(Object o, ContextMenuAdapter adapter) {
|
||||||
|
if (o instanceof GPXUtilities.WptPt && plugin.getCurrentRoute() != null){
|
||||||
|
final GPXUtilities.WptPt point = (GPXUtilities.WptPt) o;
|
||||||
|
ContextMenuAdapter.OnContextMenuClick listener = new ContextMenuAdapter.OnContextMenuClick() {
|
||||||
|
@Override
|
||||||
|
public void onContextMenuClick(int itemId, int pos, boolean isChecked, DialogInterface dialog) {
|
||||||
|
if (itemId == R.string.mark_as_not_visited){
|
||||||
|
plugin.getCurrentRoute().markPoint(point,false);
|
||||||
|
saveGPXAsync();
|
||||||
|
} else if (itemId == R.string.mark_as_visited) {
|
||||||
|
plugin.getCurrentRoute().markPoint(point, true);
|
||||||
|
saveGPXAsync();
|
||||||
|
} else if (itemId == R.string.mark_as_current){
|
||||||
|
plugin.getCurrentRoute().markPoint(point, false);
|
||||||
|
plugin.getCurrentRoute().navigateToPoint(point);
|
||||||
|
saveGPXAsync();
|
||||||
|
} else if (itemId == R.string.navigate_to_next){
|
||||||
|
plugin.getCurrentRoute().naviateToNextPoint();
|
||||||
|
saveGPXAsync();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
if (plugin.getCurrentRoute().getPointStatus(point)){
|
||||||
|
adapter.item(R.string.mark_as_not_visited).icons(
|
||||||
|
R.drawable.ic_action_gremove_dark, R.drawable.ic_action_gremove_light).listen(listener).reg();
|
||||||
|
} else {
|
||||||
|
adapter.item(R.string.mark_as_visited).icons(
|
||||||
|
R.drawable.ic_action_ok_dark, R.drawable.ic_action_ok_light).listen(listener).reg();
|
||||||
|
}
|
||||||
|
|
||||||
|
RoutePointsPlugin.RoutePoint routePoint = plugin.getCurrentRoute().getRoutePointFromWpt(point);
|
||||||
|
if (routePoint.isNextNavigate) {
|
||||||
|
adapter.item(R.string.navigate_to_next).icons(
|
||||||
|
R.drawable.ic_action_gnext_dark, R.drawable.ic_action_gnext_light).listen(listener).reg();
|
||||||
|
} else {
|
||||||
|
adapter.item(R.string.mark_as_current).icons(
|
||||||
|
R.drawable.ic_action_signpost_dark, R.drawable.ic_action_signpost_light).listen(listener).reg();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private void saveGPXAsync() {
|
||||||
|
new AsyncTask<RoutePointsPlugin.SelectedRouteGpxFile, Void, Void>() {
|
||||||
|
protected void onPreExecute() {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected Void doInBackground(RoutePointsPlugin.SelectedRouteGpxFile... params) {
|
||||||
|
if(plugin.getCurrentRoute() != null) {
|
||||||
|
plugin.getCurrentRoute().saveFile();
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void onPostExecute(Void result) {
|
||||||
|
|
||||||
|
}
|
||||||
|
}.execute(plugin.getCurrentRoute());
|
||||||
|
}
|
||||||
|
}
|
|
@ -42,6 +42,8 @@ public class RoutePointsPlugin extends OsmandPlugin {
|
||||||
private TextInfoWidget routeStepsControl;
|
private TextInfoWidget routeStepsControl;
|
||||||
private SelectedRouteGpxFile currentRoute;
|
private SelectedRouteGpxFile currentRoute;
|
||||||
|
|
||||||
|
private RoutePointsLayer routePointsLayer;
|
||||||
|
|
||||||
public RoutePointsPlugin(OsmandApplication app) {
|
public RoutePointsPlugin(OsmandApplication app) {
|
||||||
ApplicationMode.regWidget("route_steps", ApplicationMode.CAR, ApplicationMode.DEFAULT);
|
ApplicationMode.regWidget("route_steps", ApplicationMode.CAR, ApplicationMode.DEFAULT);
|
||||||
this.app = app;
|
this.app = app;
|
||||||
|
@ -53,7 +55,7 @@ public class RoutePointsPlugin extends OsmandPlugin {
|
||||||
|
|
||||||
|
|
||||||
public void setCurrentRoute(GPXFile gpx) {
|
public void setCurrentRoute(GPXFile gpx) {
|
||||||
if(gpx == null) {
|
if (gpx == null) {
|
||||||
currentRoute = null;
|
currentRoute = null;
|
||||||
} else {
|
} else {
|
||||||
currentRoute = new SelectedRouteGpxFile(gpx);
|
currentRoute = new SelectedRouteGpxFile(gpx);
|
||||||
|
@ -63,9 +65,9 @@ public class RoutePointsPlugin extends OsmandPlugin {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean destinationReached() {
|
public boolean destinationReached() {
|
||||||
if(currentRoute != null) {
|
if (currentRoute != null) {
|
||||||
boolean naviateToNextPoint = currentRoute.naviateToNextPoint();
|
boolean naviateToNextPoint = currentRoute.naviateToNextPoint();
|
||||||
if(naviateToNextPoint) {
|
if (naviateToNextPoint) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -97,7 +99,7 @@ public class RoutePointsPlugin extends OsmandPlugin {
|
||||||
if (mapInfoLayer != null) {
|
if (mapInfoLayer != null) {
|
||||||
routeStepsControl = createRouteStepsInfoControl(activity, mapInfoLayer.getPaintSubText(), mapInfoLayer.getPaintSubText());
|
routeStepsControl = createRouteStepsInfoControl(activity, mapInfoLayer.getPaintSubText(), mapInfoLayer.getPaintSubText());
|
||||||
mapInfoLayer.getMapInfoControls().registerSideWidget(routeStepsControl,
|
mapInfoLayer.getMapInfoControls().registerSideWidget(routeStepsControl,
|
||||||
R.drawable.widget_target, R.string.map_widget_route_points, "route_steps", false, 8);
|
R.drawable.ic_signpost, R.string.map_widget_route_points, "route_steps", false, 8);
|
||||||
mapInfoLayer.recreateControls();
|
mapInfoLayer.recreateControls();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -105,11 +107,22 @@ public class RoutePointsPlugin extends OsmandPlugin {
|
||||||
@Override
|
@Override
|
||||||
public void registerLayers(MapActivity activity) {
|
public void registerLayers(MapActivity activity) {
|
||||||
super.registerLayers(activity);
|
super.registerLayers(activity);
|
||||||
|
|
||||||
|
if (routePointsLayer != null) {
|
||||||
|
activity.getMapView().removeLayer(routePointsLayer);
|
||||||
|
}
|
||||||
|
|
||||||
|
routePointsLayer = new RoutePointsLayer(activity, this);
|
||||||
|
activity.getMapView().addLayer(routePointsLayer, 5.5f);
|
||||||
registerWidget(activity);
|
registerWidget(activity);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void updateLayers(OsmandMapTileView mapView, MapActivity activity) {
|
public void updateLayers(OsmandMapTileView mapView, MapActivity activity) {
|
||||||
|
if (routePointsLayer == null){
|
||||||
|
registerLayers(activity);
|
||||||
|
}
|
||||||
|
|
||||||
if (routeStepsControl == null) {
|
if (routeStepsControl == null) {
|
||||||
registerWidget(activity);
|
registerWidget(activity);
|
||||||
}
|
}
|
||||||
|
@ -143,7 +156,7 @@ public class RoutePointsPlugin extends OsmandPlugin {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
routeStepsControl.setText(null, null);
|
routeStepsControl.setText(null, null);
|
||||||
routeStepsControl.setImageDrawable(map.getResources().getDrawable(R.drawable.widget_target));
|
routeStepsControl.setImageDrawable(map.getResources().getDrawable(R.drawable.ic_signpost));
|
||||||
return routeStepsControl;
|
return routeStepsControl;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -165,6 +178,7 @@ public class RoutePointsPlugin extends OsmandPlugin {
|
||||||
public boolean isNextNavigate() {
|
public boolean isNextNavigate() {
|
||||||
return isNextNavigate;
|
return isNextNavigate;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isVisited() {
|
public boolean isVisited() {
|
||||||
return visitedTime != 0;
|
return visitedTime != 0;
|
||||||
}
|
}
|
||||||
|
@ -180,7 +194,7 @@ public class RoutePointsPlugin extends OsmandPlugin {
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getTime() {
|
public String getTime() {
|
||||||
if(visitedTime == 0) {
|
if (visitedTime == 0) {
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
String dateString;
|
String dateString;
|
||||||
|
@ -199,7 +213,7 @@ public class RoutePointsPlugin extends OsmandPlugin {
|
||||||
|
|
||||||
public void setVisitedTime(long currentTimeMillis) {
|
public void setVisitedTime(long currentTimeMillis) {
|
||||||
visitedTime = currentTimeMillis;
|
visitedTime = currentTimeMillis;
|
||||||
wpt.getExtensionsToWrite().put(VISITED_KEY, visitedTime+"");
|
wpt.getExtensionsToWrite().put(VISITED_KEY, visitedTime + "");
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -220,8 +234,8 @@ public class RoutePointsPlugin extends OsmandPlugin {
|
||||||
|
|
||||||
public int getVisitedCount() {
|
public int getVisitedCount() {
|
||||||
int k = 0;
|
int k = 0;
|
||||||
for(RoutePoint rp : currentPoints) {
|
for (RoutePoint rp : currentPoints) {
|
||||||
if(rp.isVisited()) {
|
if (rp.isVisited()) {
|
||||||
k++;
|
k++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -233,7 +247,7 @@ public class RoutePointsPlugin extends OsmandPlugin {
|
||||||
}
|
}
|
||||||
|
|
||||||
public GPXUtilities.Route getRoute() {
|
public GPXUtilities.Route getRoute() {
|
||||||
if(gpx.routes.isEmpty()) {
|
if (gpx.routes.isEmpty()) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
return gpx.routes.get(0);
|
return gpx.routes.get(0);
|
||||||
|
@ -244,11 +258,11 @@ public class RoutePointsPlugin extends OsmandPlugin {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void markPoint(RoutePoint point, boolean visited) {
|
public void markPoint(RoutePoint point, boolean visited) {
|
||||||
if(point.isNextNavigate() && visited) {
|
if (point.isNextNavigate() && visited) {
|
||||||
naviateToNextPoint();
|
naviateToNextPoint();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if(visited) {
|
if (visited) {
|
||||||
point.setVisitedTime(System.currentTimeMillis());
|
point.setVisitedTime(System.currentTimeMillis());
|
||||||
} else {
|
} else {
|
||||||
point.setVisitedTime(0);
|
point.setVisitedTime(0);
|
||||||
|
@ -257,14 +271,14 @@ public class RoutePointsPlugin extends OsmandPlugin {
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean naviateToNextPoint() {
|
public boolean naviateToNextPoint() {
|
||||||
if(!currentPoints.isEmpty()) {
|
if (!currentPoints.isEmpty()) {
|
||||||
RoutePoint rp = currentPoints.get(0);
|
RoutePoint rp = currentPoints.get(0);
|
||||||
if(rp.isNextNavigate) {
|
if (rp.isNextNavigate) {
|
||||||
rp.setVisitedTime(System.currentTimeMillis());
|
rp.setVisitedTime(System.currentTimeMillis());
|
||||||
sortPoints();
|
sortPoints();
|
||||||
}
|
}
|
||||||
RoutePoint first = currentPoints.get(0);
|
RoutePoint first = currentPoints.get(0);
|
||||||
if(!first.isVisited()) {
|
if (!first.isVisited()) {
|
||||||
app.getTargetPointsHelper().navigateToPoint(first.getPoint(), true, -1, first.getName());
|
app.getTargetPointsHelper().navigateToPoint(first.getPoint(), true, -1, first.getName());
|
||||||
first.isNextNavigate = true;
|
first.isNextNavigate = true;
|
||||||
return true;
|
return true;
|
||||||
|
@ -280,14 +294,14 @@ public class RoutePointsPlugin extends OsmandPlugin {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int compare(RoutePoint lhs, RoutePoint rhs) {
|
public int compare(RoutePoint lhs, RoutePoint rhs) {
|
||||||
if(lhs.isNextNavigate || rhs.isNextNavigate) {
|
if (lhs.isNextNavigate || rhs.isNextNavigate) {
|
||||||
return lhs.isNextNavigate? -1 : 1;
|
return lhs.isNextNavigate ? -1 : 1;
|
||||||
}
|
}
|
||||||
if(!lhs.isVisited() || !rhs.isVisited()) {
|
if (!lhs.isVisited() || !rhs.isVisited()) {
|
||||||
if(lhs.isVisited()) {
|
if (lhs.isVisited()) {
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
if(rhs.isVisited()) {
|
if (rhs.isVisited()) {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
return lcompare(lhs.gpxOrder, rhs.gpxOrder);
|
return lcompare(lhs.gpxOrder, rhs.gpxOrder);
|
||||||
|
@ -296,8 +310,8 @@ public class RoutePointsPlugin extends OsmandPlugin {
|
||||||
}
|
}
|
||||||
|
|
||||||
public int lcompare(long lhs, long rhs) {
|
public int lcompare(long lhs, long rhs) {
|
||||||
return lhs < rhs ? -1 : (lhs == rhs ? 0 : 1);
|
return lhs < rhs ? -1 : (lhs == rhs ? 0 : 1);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -306,10 +320,10 @@ public class RoutePointsPlugin extends OsmandPlugin {
|
||||||
this.gpx = gpx;
|
this.gpx = gpx;
|
||||||
Route rt = getRoute();
|
Route rt = getRoute();
|
||||||
currentPoints.clear();
|
currentPoints.clear();
|
||||||
if(rt != null) {
|
if (rt != null) {
|
||||||
TargetPointsHelper targetPointsHelper = app.getTargetPointsHelper();
|
TargetPointsHelper targetPointsHelper = app.getTargetPointsHelper();
|
||||||
String locName = targetPointsHelper.getPointNavigateDescription();
|
String locName = targetPointsHelper.getPointNavigateDescription();
|
||||||
for(int i = 0; i < rt.points.size(); i++) {
|
for (int i = 0; i < rt.points.size(); i++) {
|
||||||
WptPt wptPt = rt.points.get(i);
|
WptPt wptPt = rt.points.get(i);
|
||||||
RoutePoint rtp = new RoutePoint();
|
RoutePoint rtp = new RoutePoint();
|
||||||
rtp.gpxOrder = i;
|
rtp.gpxOrder = i;
|
||||||
|
@ -320,7 +334,7 @@ public class RoutePointsPlugin extends OsmandPlugin {
|
||||||
} catch (NumberFormatException e) {
|
} catch (NumberFormatException e) {
|
||||||
}
|
}
|
||||||
rtp.isNextNavigate = rtp.visitedTime == 0 && locName != null && locName.equals(wptPt.name);
|
rtp.isNextNavigate = rtp.visitedTime == 0 && locName != null && locName.equals(wptPt.name);
|
||||||
if(rtp.isNextNavigate) {
|
if (rtp.isNextNavigate) {
|
||||||
locName = null;
|
locName = null;
|
||||||
}
|
}
|
||||||
currentPoints.add(rtp);
|
currentPoints.add(rtp);
|
||||||
|
@ -347,10 +361,10 @@ public class RoutePointsPlugin extends OsmandPlugin {
|
||||||
public void updateCurrentTargetPoint() {
|
public void updateCurrentTargetPoint() {
|
||||||
TargetPointsHelper targetPointsHelper = app.getTargetPointsHelper();
|
TargetPointsHelper targetPointsHelper = app.getTargetPointsHelper();
|
||||||
String locName = targetPointsHelper.getPointNavigateDescription();
|
String locName = targetPointsHelper.getPointNavigateDescription();
|
||||||
for(int i = 0; i < currentPoints.size(); i++) {
|
for (int i = 0; i < currentPoints.size(); i++) {
|
||||||
RoutePoint rtp = currentPoints.get(i);
|
RoutePoint rtp = currentPoints.get(i);
|
||||||
rtp.isNextNavigate = rtp.visitedTime == 0 && locName != null && locName.equals(rtp.getName());
|
rtp.isNextNavigate = rtp.visitedTime == 0 && locName != null && locName.equals(rtp.getName());
|
||||||
if(rtp.isNextNavigate) {
|
if (rtp.isNextNavigate) {
|
||||||
locName = null;
|
locName = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -358,6 +372,35 @@ public class RoutePointsPlugin extends OsmandPlugin {
|
||||||
sortPoints();
|
sortPoints();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
public boolean getPointStatus(WptPt p) {
|
||||||
|
RoutePoint point = getRoutePointFromWpt(p);
|
||||||
|
return point != null && (point.isVisited());
|
||||||
|
}
|
||||||
|
|
||||||
|
public void markPoint(WptPt point, boolean visited) {
|
||||||
|
RoutePoint routePoint = getRoutePointFromWpt(point);
|
||||||
|
if (routePoint != null) {
|
||||||
|
markPoint(routePoint, visited);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void navigateToPoint(WptPt point) {
|
||||||
|
RoutePoint routePoint = getRoutePointFromWpt(point);
|
||||||
|
if (routePoint != null) {
|
||||||
|
navigateToPoint(routePoint);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public RoutePoint getRoutePointFromWpt(WptPt point) {
|
||||||
|
if (currentPoints != null) {
|
||||||
|
for (RoutePoint find : currentPoints) {
|
||||||
|
WptPt itemToFind = find.getWpt();
|
||||||
|
if (itemToFind.equals(point)) {
|
||||||
|
return find;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue