Added point icon for route track details
This commit is contained in:
parent
24742f78ce
commit
374c23d564
5 changed files with 60 additions and 12 deletions
|
@ -673,6 +673,7 @@ public class GpxSelectionHelper {
|
||||||
public String url;
|
public String url;
|
||||||
public Bitmap image;
|
public Bitmap image;
|
||||||
public boolean expanded;
|
public boolean expanded;
|
||||||
|
public boolean route;
|
||||||
|
|
||||||
public WptPt locationOnMap;
|
public WptPt locationOnMap;
|
||||||
public GPXDataSetType chartType;
|
public GPXDataSetType chartType;
|
||||||
|
|
|
@ -223,6 +223,9 @@ public class ShowRouteInfoDialogFragment extends DialogFragment {
|
||||||
GpxDisplayGroup group = getMyApplication().getSelectedGpxHelper().buildGpxDisplayGroup(gpx, 0, groupName);
|
GpxDisplayGroup group = getMyApplication().getSelectedGpxHelper().buildGpxDisplayGroup(gpx, 0, groupName);
|
||||||
if (group != null && group.getModifiableList().size() > 0) {
|
if (group != null && group.getModifiableList().size() > 0) {
|
||||||
gpxItem = group.getModifiableList().get(0);
|
gpxItem = group.getModifiableList().get(0);
|
||||||
|
if (gpxItem != null) {
|
||||||
|
gpxItem.route = true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -126,6 +126,7 @@ public class TrackDetailsMenu {
|
||||||
}
|
}
|
||||||
mapActivity.getMapLayers().getContextMenuLayer().exitGpxDetailsMode();
|
mapActivity.getMapLayers().getContextMenuLayer().exitGpxDetailsMode();
|
||||||
mapActivity.getMapLayers().getGpxLayer().setSelectedPointLatLon(null);
|
mapActivity.getMapLayers().getGpxLayer().setSelectedPointLatLon(null);
|
||||||
|
mapActivity.getMapLayers().getMapInfoLayer().setSelectedPointLatLon(null);
|
||||||
mapActivity.getMapView().setMapPositionX(0);
|
mapActivity.getMapView().setMapPositionX(0);
|
||||||
mapActivity.getMapView().refreshMap();
|
mapActivity.getMapView().refreshMap();
|
||||||
}
|
}
|
||||||
|
@ -183,7 +184,11 @@ public class TrackDetailsMenu {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (wpt != null) {
|
if (wpt != null) {
|
||||||
|
if (gpxItem.route) {
|
||||||
|
mapActivity.getMapLayers().getMapInfoLayer().setSelectedPointLatLon(new LatLon(wpt.lat, wpt.lon));
|
||||||
|
} else {
|
||||||
mapActivity.getMapLayers().getGpxLayer().setSelectedPointLatLon(new LatLon(wpt.lat, wpt.lon));
|
mapActivity.getMapLayers().getGpxLayer().setSelectedPointLatLon(new LatLon(wpt.lat, wpt.lon));
|
||||||
|
}
|
||||||
mapActivity.setMapLocation(wpt.lat, wpt.lon);
|
mapActivity.setMapLocation(wpt.lat, wpt.lon);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,8 +1,16 @@
|
||||||
package net.osmand.plus.views;
|
package net.osmand.plus.views;
|
||||||
|
|
||||||
|
|
||||||
import java.lang.reflect.Field;
|
import android.content.Context;
|
||||||
|
import android.graphics.Canvas;
|
||||||
|
import android.graphics.Color;
|
||||||
|
import android.support.v4.content.ContextCompat;
|
||||||
|
import android.view.View;
|
||||||
|
import android.view.View.OnClickListener;
|
||||||
|
import android.widget.ImageButton;
|
||||||
|
import android.widget.LinearLayout;
|
||||||
|
|
||||||
|
import net.osmand.data.LatLon;
|
||||||
import net.osmand.data.RotatedTileBox;
|
import net.osmand.data.RotatedTileBox;
|
||||||
import net.osmand.plus.OsmandApplication;
|
import net.osmand.plus.OsmandApplication;
|
||||||
import net.osmand.plus.OsmandSettings;
|
import net.osmand.plus.OsmandSettings;
|
||||||
|
@ -26,14 +34,8 @@ import net.osmand.plus.views.mapwidgets.RouteInfoWidgetsFactory.LanesControl;
|
||||||
import net.osmand.plus.views.mapwidgets.RouteInfoWidgetsFactory.RulerWidget;
|
import net.osmand.plus.views.mapwidgets.RouteInfoWidgetsFactory.RulerWidget;
|
||||||
import net.osmand.plus.views.mapwidgets.RouteInfoWidgetsFactory.TimeControlWidgetState;
|
import net.osmand.plus.views.mapwidgets.RouteInfoWidgetsFactory.TimeControlWidgetState;
|
||||||
import net.osmand.plus.views.mapwidgets.TextInfoWidget;
|
import net.osmand.plus.views.mapwidgets.TextInfoWidget;
|
||||||
import android.content.Context;
|
|
||||||
import android.graphics.Canvas;
|
import java.lang.reflect.Field;
|
||||||
import android.graphics.Color;
|
|
||||||
import android.support.v4.content.ContextCompat;
|
|
||||||
import android.view.View;
|
|
||||||
import android.view.View.OnClickListener;
|
|
||||||
import android.widget.ImageButton;
|
|
||||||
import android.widget.LinearLayout;
|
|
||||||
|
|
||||||
public class MapInfoLayer extends OsmandMapLayer {
|
public class MapInfoLayer extends OsmandMapLayer {
|
||||||
private final MapActivity map;
|
private final MapActivity map;
|
||||||
|
@ -55,6 +57,8 @@ public class MapInfoLayer extends OsmandMapLayer {
|
||||||
private TopTextView streetNameView;
|
private TopTextView streetNameView;
|
||||||
private TopToolbarView topToolbarView;
|
private TopToolbarView topToolbarView;
|
||||||
|
|
||||||
|
private LatLon selectedPointLatLon;
|
||||||
|
|
||||||
public MapInfoLayer(MapActivity map, RouteLayer layer){
|
public MapInfoLayer(MapActivity map, RouteLayer layer){
|
||||||
this.map = map;
|
this.map = map;
|
||||||
settings = map.getMyApplication().getSettings();
|
settings = map.getMyApplication().getSettings();
|
||||||
|
@ -206,6 +210,15 @@ public class MapInfoLayer extends OsmandMapLayer {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public LatLon getSelectedPointLatLon() {
|
||||||
|
return selectedPointLatLon;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setSelectedPointLatLon(LatLon selectedPointLatLon) {
|
||||||
|
this.selectedPointLatLon = selectedPointLatLon;
|
||||||
|
routeLayer.setSelectedPointLatLon(selectedPointLatLon);
|
||||||
|
}
|
||||||
|
|
||||||
private static class TextState {
|
private static class TextState {
|
||||||
boolean textBold ;
|
boolean textBold ;
|
||||||
boolean night;
|
boolean night;
|
||||||
|
|
|
@ -10,6 +10,7 @@ import java.util.List;
|
||||||
import java.util.TreeMap;
|
import java.util.TreeMap;
|
||||||
|
|
||||||
import net.osmand.Location;
|
import net.osmand.Location;
|
||||||
|
import net.osmand.data.LatLon;
|
||||||
import net.osmand.data.QuadRect;
|
import net.osmand.data.QuadRect;
|
||||||
import net.osmand.data.RotatedTileBox;
|
import net.osmand.data.RotatedTileBox;
|
||||||
import net.osmand.plus.R;
|
import net.osmand.plus.R;
|
||||||
|
@ -48,6 +49,10 @@ public class RouteLayer extends OsmandMapLayer {
|
||||||
private Paint paintIcon;
|
private Paint paintIcon;
|
||||||
private Paint paintIconAction;
|
private Paint paintIconAction;
|
||||||
|
|
||||||
|
private Paint paintIconSelected;
|
||||||
|
private Bitmap selectedPoint;
|
||||||
|
private LatLon selectedPointLatLon;
|
||||||
|
|
||||||
private RenderingLineAttributes attrs;
|
private RenderingLineAttributes attrs;
|
||||||
|
|
||||||
|
|
||||||
|
@ -55,6 +60,13 @@ public class RouteLayer extends OsmandMapLayer {
|
||||||
this.helper = helper;
|
this.helper = helper;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public LatLon getSelectedPointLatLon() {
|
||||||
|
return selectedPointLatLon;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setSelectedPointLatLon(LatLon selectedPointLatLon) {
|
||||||
|
this.selectedPointLatLon = selectedPointLatLon;
|
||||||
|
}
|
||||||
|
|
||||||
private void initUI() {
|
private void initUI() {
|
||||||
actionArrow = BitmapFactory.decodeResource(view.getResources(), R.drawable.map_action_arrow, null);
|
actionArrow = BitmapFactory.decodeResource(view.getResources(), R.drawable.map_action_arrow, null);
|
||||||
|
@ -79,6 +91,9 @@ public class RouteLayer extends OsmandMapLayer {
|
||||||
|
|
||||||
attrs.paint2.setStrokeCap(Cap.BUTT);
|
attrs.paint2.setStrokeCap(Cap.BUTT);
|
||||||
attrs.paint2.setColor(Color.BLACK);
|
attrs.paint2.setColor(Color.BLACK);
|
||||||
|
|
||||||
|
paintIconSelected = new Paint();
|
||||||
|
selectedPoint = BitmapFactory.decodeResource(view.getResources(), R.drawable.map_default_location);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -133,6 +148,17 @@ public class RouteLayer extends OsmandMapLayer {
|
||||||
double lat = topLatitude - bottomLatitude + 0.1;
|
double lat = topLatitude - bottomLatitude + 0.1;
|
||||||
double lon = rightLongitude - leftLongitude + 0.1;
|
double lon = rightLongitude - leftLongitude + 0.1;
|
||||||
drawLocations(tileBox, canvas, topLatitude + lat, leftLongitude - lon, bottomLatitude - lat, rightLongitude + lon);
|
drawLocations(tileBox, canvas, topLatitude + lat, leftLongitude - lon, bottomLatitude - lat, rightLongitude + lon);
|
||||||
|
|
||||||
|
if (selectedPointLatLon != null
|
||||||
|
&& selectedPointLatLon.getLatitude() >= latlonRect.bottom
|
||||||
|
&& selectedPointLatLon.getLatitude() <= latlonRect.top
|
||||||
|
&& selectedPointLatLon.getLongitude() >= latlonRect.left
|
||||||
|
&& selectedPointLatLon.getLongitude() <= latlonRect.right) {
|
||||||
|
float x = tileBox.getPixXFromLatLon(selectedPointLatLon.getLatitude(), selectedPointLatLon.getLongitude());
|
||||||
|
float y = tileBox.getPixYFromLatLon(selectedPointLatLon.getLatitude(), selectedPointLatLon.getLongitude());
|
||||||
|
paintIcon.setColorFilter(null);
|
||||||
|
canvas.drawBitmap(selectedPoint, x - selectedPoint.getWidth() / 2, y - selectedPoint.getHeight() / 2, paintIconSelected);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue