Add point remove
This commit is contained in:
parent
5133319f81
commit
36846caad6
2 changed files with 32 additions and 4 deletions
|
@ -9,6 +9,7 @@
|
||||||
3. All your modified/created strings are in the top of the file (to make easier find what\'s translated).
|
3. All your modified/created strings are in the top of the file (to make easier find what\'s translated).
|
||||||
PLEASE: Have a look at http://code.google.com/p/osmand/wiki/UIConsistency, it may really improve your and our work :-) Thx - Hardy
|
PLEASE: Have a look at http://code.google.com/p/osmand/wiki/UIConsistency, it may really improve your and our work :-) Thx - Hardy
|
||||||
-->
|
-->
|
||||||
|
<string name="delete_point">Delete Point</string>
|
||||||
<string name="plugin_distance_point_time">time</string>
|
<string name="plugin_distance_point_time">time</string>
|
||||||
<string name="plugin_distance_point_hdop">precision</string>
|
<string name="plugin_distance_point_hdop">precision</string>
|
||||||
<string name="plugin_distance_point_speed">speed</string>
|
<string name="plugin_distance_point_speed">speed</string>
|
||||||
|
|
|
@ -16,6 +16,8 @@ import net.osmand.IndexConstants;
|
||||||
import net.osmand.access.AccessibleToast;
|
import net.osmand.access.AccessibleToast;
|
||||||
import net.osmand.data.LatLon;
|
import net.osmand.data.LatLon;
|
||||||
import net.osmand.plus.ApplicationMode;
|
import net.osmand.plus.ApplicationMode;
|
||||||
|
import net.osmand.plus.ContextMenuAdapter;
|
||||||
|
import net.osmand.plus.ContextMenuAdapter.OnContextMenuClick;
|
||||||
import net.osmand.plus.GPXUtilities;
|
import net.osmand.plus.GPXUtilities;
|
||||||
import net.osmand.plus.GPXUtilities.GPXFile;
|
import net.osmand.plus.GPXUtilities.GPXFile;
|
||||||
import net.osmand.plus.GPXUtilities.Route;
|
import net.osmand.plus.GPXUtilities.Route;
|
||||||
|
@ -106,7 +108,7 @@ public class DistanceCalculatorPlugin extends OsmandPlugin {
|
||||||
activity.getMapView().removeLayer(distanceCalculatorLayer);
|
activity.getMapView().removeLayer(distanceCalculatorLayer);
|
||||||
}
|
}
|
||||||
distanceCalculatorLayer = new DistanceCalculatorLayer();
|
distanceCalculatorLayer = new DistanceCalculatorLayer();
|
||||||
activity.getMapView().addLayer(distanceCalculatorLayer, 8.5f);
|
activity.getMapView().addLayer(distanceCalculatorLayer, 4.5f);
|
||||||
|
|
||||||
registerWidget(activity);
|
registerWidget(activity);
|
||||||
}
|
}
|
||||||
|
@ -529,11 +531,11 @@ public class DistanceCalculatorPlugin extends OsmandPlugin {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void getMPointsFromPoint(PointF point, List<? super WptPt> res) {
|
public void getMPointsFromPoint(PointF point, List<? super WptPt> res) {
|
||||||
int r = (int) (12* dm.density);
|
int r = (int) (14 * dm.density);
|
||||||
int rs = (int) (7* dm.density);
|
int rs = (int) (10 * dm.density);
|
||||||
int ex = (int) point.x;
|
int ex = (int) point.x;
|
||||||
int ey = (int) point.y;
|
int ey = (int) point.y;
|
||||||
for(int i = 0; i < measurementPoints.size(); i++) {
|
for (int i = 0; i < measurementPoints.size(); i++) {
|
||||||
Iterator<WptPt> it = measurementPoints.get(i).iterator();
|
Iterator<WptPt> it = measurementPoints.get(i).iterator();
|
||||||
boolean first = true;
|
boolean first = true;
|
||||||
while (it.hasNext()) {
|
while (it.hasNext()) {
|
||||||
|
@ -569,6 +571,31 @@ public class DistanceCalculatorPlugin extends OsmandPlugin {
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void populateObjectContextMenu(Object o, ContextMenuAdapter adapter) {
|
||||||
|
if(o instanceof WptPt) {
|
||||||
|
final WptPt p = (WptPt) o;
|
||||||
|
OnContextMenuClick listener = new OnContextMenuClick() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onContextMenuClick(int itemId, int pos, boolean isChecked, DialogInterface dialog) {
|
||||||
|
if (itemId == R.string.delete_point) {
|
||||||
|
for(int i = 0; i<measurementPoints.size(); i++) {
|
||||||
|
Iterator<WptPt> it = measurementPoints.get(i).iterator();
|
||||||
|
while(it.hasNext()) {
|
||||||
|
if(it.next() == p) {
|
||||||
|
it.remove();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
calculateDistance();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
adapter.registerItem(R.string.delete_point, R.drawable.list_activities_remove_note, listener, -1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getObjectDescription(Object o) {
|
public String getObjectDescription(Object o) {
|
||||||
|
|
Loading…
Reference in a new issue