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 Bitmap image;
|
||||
public boolean expanded;
|
||||
public boolean route;
|
||||
|
||||
public WptPt locationOnMap;
|
||||
public GPXDataSetType chartType;
|
||||
|
|
|
@ -223,6 +223,9 @@ public class ShowRouteInfoDialogFragment extends DialogFragment {
|
|||
GpxDisplayGroup group = getMyApplication().getSelectedGpxHelper().buildGpxDisplayGroup(gpx, 0, groupName);
|
||||
if (group != null && group.getModifiableList().size() > 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().getGpxLayer().setSelectedPointLatLon(null);
|
||||
mapActivity.getMapLayers().getMapInfoLayer().setSelectedPointLatLon(null);
|
||||
mapActivity.getMapView().setMapPositionX(0);
|
||||
mapActivity.getMapView().refreshMap();
|
||||
}
|
||||
|
@ -183,7 +184,11 @@ public class TrackDetailsMenu {
|
|||
}
|
||||
}
|
||||
if (wpt != null) {
|
||||
mapActivity.getMapLayers().getGpxLayer().setSelectedPointLatLon(new LatLon(wpt.lat, wpt.lon));
|
||||
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.setMapLocation(wpt.lat, wpt.lon);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,8 +1,16 @@
|
|||
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.plus.OsmandApplication;
|
||||
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.TimeControlWidgetState;
|
||||
import net.osmand.plus.views.mapwidgets.TextInfoWidget;
|
||||
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 java.lang.reflect.Field;
|
||||
|
||||
public class MapInfoLayer extends OsmandMapLayer {
|
||||
private final MapActivity map;
|
||||
|
@ -55,6 +57,8 @@ public class MapInfoLayer extends OsmandMapLayer {
|
|||
private TopTextView streetNameView;
|
||||
private TopToolbarView topToolbarView;
|
||||
|
||||
private LatLon selectedPointLatLon;
|
||||
|
||||
public MapInfoLayer(MapActivity map, RouteLayer layer){
|
||||
this.map = map;
|
||||
settings = map.getMyApplication().getSettings();
|
||||
|
@ -205,7 +209,16 @@ 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 {
|
||||
boolean textBold ;
|
||||
boolean night;
|
||||
|
|
|
@ -10,6 +10,7 @@ import java.util.List;
|
|||
import java.util.TreeMap;
|
||||
|
||||
import net.osmand.Location;
|
||||
import net.osmand.data.LatLon;
|
||||
import net.osmand.data.QuadRect;
|
||||
import net.osmand.data.RotatedTileBox;
|
||||
import net.osmand.plus.R;
|
||||
|
@ -48,13 +49,24 @@ public class RouteLayer extends OsmandMapLayer {
|
|||
private Paint paintIcon;
|
||||
private Paint paintIconAction;
|
||||
|
||||
private Paint paintIconSelected;
|
||||
private Bitmap selectedPoint;
|
||||
private LatLon selectedPointLatLon;
|
||||
|
||||
private RenderingLineAttributes attrs;
|
||||
|
||||
|
||||
public RouteLayer(RoutingHelper helper){
|
||||
this.helper = helper;
|
||||
}
|
||||
|
||||
|
||||
public LatLon getSelectedPointLatLon() {
|
||||
return selectedPointLatLon;
|
||||
}
|
||||
|
||||
public void setSelectedPointLatLon(LatLon selectedPointLatLon) {
|
||||
this.selectedPointLatLon = selectedPointLatLon;
|
||||
}
|
||||
|
||||
private void initUI() {
|
||||
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.setColor(Color.BLACK);
|
||||
|
||||
paintIconSelected = new Paint();
|
||||
selectedPoint = BitmapFactory.decodeResource(view.getResources(), R.drawable.map_default_location);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -133,6 +148,17 @@ public class RouteLayer extends OsmandMapLayer {
|
|||
double lat = topLatitude - bottomLatitude + 0.1;
|
||||
double lon = rightLongitude - leftLongitude + 0.1;
|
||||
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