diff --git a/OsmAnd/src/net/osmand/plus/helpers/IntentHelper.java b/OsmAnd/src/net/osmand/plus/helpers/IntentHelper.java index ba48fe6899..6fce7b78a6 100644 --- a/OsmAnd/src/net/osmand/plus/helpers/IntentHelper.java +++ b/OsmAnd/src/net/osmand/plus/helpers/IntentHelper.java @@ -18,8 +18,8 @@ import net.osmand.plus.R; import net.osmand.plus.activities.MapActivity; import net.osmand.plus.activities.PluginsFragment; import net.osmand.plus.dashboard.DashboardOnMap.DashboardType; -import net.osmand.plus.mapmarkers.MapMarkersDialogFragment; import net.osmand.plus.itinerary.ItineraryGroup; +import net.osmand.plus.mapmarkers.MapMarkersDialogFragment; import net.osmand.plus.mapsource.EditMapSourceDialogFragment; import net.osmand.plus.openplacereviews.OPRConstants; import net.osmand.plus.openplacereviews.OprAuthHelper.OprAuthorizationListener; @@ -259,7 +259,7 @@ public class IntentHelper { String path = intent.getStringExtra(TRACK_FILE_NAME); String name = intent.getStringExtra(RETURN_SCREEN_NAME); boolean currentRecording = intent.getBooleanExtra(CURRENT_RECORDING, false); - TrackMenuFragment.showInstance(mapActivity, path, currentRecording, null, name, null); + TrackMenuFragment.showInstance(mapActivity, path, currentRecording, name, null); mapActivity.setIntent(null); } } diff --git a/OsmAnd/src/net/osmand/plus/mapcontextmenu/builders/SelectedGpxMenuBuilder.java b/OsmAnd/src/net/osmand/plus/mapcontextmenu/builders/SelectedGpxMenuBuilder.java index e4c2bc71ed..a87e35590e 100644 --- a/OsmAnd/src/net/osmand/plus/mapcontextmenu/builders/SelectedGpxMenuBuilder.java +++ b/OsmAnd/src/net/osmand/plus/mapcontextmenu/builders/SelectedGpxMenuBuilder.java @@ -153,9 +153,11 @@ public class SelectedGpxMenuBuilder extends MenuBuilder { OsmAndFormatter.getFormattedSpeed((float) selectedPoint.speed, app), 0, null, false, null, false, 0, false, false, false, null, false); } - buildRow(view, getThemedIcon(R.drawable.ic_action_relative_bearing), null, app.getString(R.string.shared_string_bearing), - OsmAndFormatter.getFormattedAzimuth(selectedGpxPoint.getBearing(), app), 0, null, - false, null, false, 0, false, false, false, null, false); + if (!Float.isNaN(selectedGpxPoint.getBearing())) { + buildRow(view, getThemedIcon(R.drawable.ic_action_relative_bearing), null, app.getString(R.string.shared_string_bearing), + OsmAndFormatter.getFormattedAzimuth(selectedGpxPoint.getBearing(), app), 0, null, + false, null, false, 0, false, false, false, null, false); + } } private void buildCategoryView(View view, String name) { diff --git a/OsmAnd/src/net/osmand/plus/mapcontextmenu/controllers/SelectedGpxMenuController.java b/OsmAnd/src/net/osmand/plus/mapcontextmenu/controllers/SelectedGpxMenuController.java index 80dd39f959..76b8ff1c7b 100644 --- a/OsmAnd/src/net/osmand/plus/mapcontextmenu/controllers/SelectedGpxMenuController.java +++ b/OsmAnd/src/net/osmand/plus/mapcontextmenu/controllers/SelectedGpxMenuController.java @@ -43,11 +43,8 @@ public class SelectedGpxMenuController extends MenuController { @Override public void buttonPressed() { mapContextMenu.close(); - WptPt wptPt = selectedGpxPoint.selectedPoint; - LatLon latLon = new LatLon(wptPt.lat, wptPt.lon); SelectedGpxFile selectedGpxFile = selectedGpxPoint.getSelectedGpxFile(); - String path = selectedGpxFile.getGpxFile().path; - TrackMenuFragment.showInstance(mapActivity, path, selectedGpxFile.isShowCurrentTrack(), latLon, null, null); + TrackMenuFragment.showInstance(mapActivity, selectedGpxFile, selectedGpxPoint, null, null, false); } }; leftTitleButtonController.caption = mapActivity.getString(R.string.shared_string_open_track); @@ -215,11 +212,15 @@ public class SelectedGpxMenuController extends MenuController { public static class SelectedGpxPoint { + private final WptPt prevPoint; + private final WptPt nextPoint; private final WptPt selectedPoint; private final SelectedGpxFile selectedGpxFile; private final float bearing; - public SelectedGpxPoint(SelectedGpxFile selectedGpxFile, WptPt selectedPoint, float bearing) { + public SelectedGpxPoint(SelectedGpxFile selectedGpxFile, WptPt selectedPoint, WptPt prevPoint, WptPt nextPoint, float bearing) { + this.prevPoint = prevPoint; + this.nextPoint = nextPoint; this.selectedPoint = selectedPoint; this.selectedGpxFile = selectedGpxFile; this.bearing = bearing; @@ -236,5 +237,13 @@ public class SelectedGpxMenuController extends MenuController { public float getBearing() { return bearing; } + + public WptPt getPrevPoint() { + return prevPoint; + } + + public WptPt getNextPoint() { + return nextPoint; + } } } \ No newline at end of file diff --git a/OsmAnd/src/net/osmand/plus/mapcontextmenu/controllers/WptPtMenuController.java b/OsmAnd/src/net/osmand/plus/mapcontextmenu/controllers/WptPtMenuController.java index d9ad62cad9..95a266563c 100644 --- a/OsmAnd/src/net/osmand/plus/mapcontextmenu/controllers/WptPtMenuController.java +++ b/OsmAnd/src/net/osmand/plus/mapcontextmenu/controllers/WptPtMenuController.java @@ -17,6 +17,7 @@ import net.osmand.plus.activities.MapActivity; import net.osmand.plus.base.PointImageDrawable; import net.osmand.plus.mapcontextmenu.MenuBuilder; import net.osmand.plus.mapcontextmenu.MenuController; +import net.osmand.plus.mapcontextmenu.controllers.SelectedGpxMenuController.SelectedGpxPoint; import net.osmand.plus.mapmarkers.MapMarker; import net.osmand.plus.mapmarkers.MapMarkersHelper; import net.osmand.plus.track.TrackMenuFragment; @@ -49,8 +50,8 @@ public class WptPtMenuController extends MenuController { GpxSelectionHelper selectionHelper = mapActivity.getMyApplication().getSelectedGpxHelper(); SelectedGpxFile selectedGpxFile = selectionHelper.getSelectedGPXFile(wpt); if (selectedGpxFile != null) { - String path = selectedGpxFile.getGpxFile().path; - TrackMenuFragment.showInstance(mapActivity, path, selectedGpxFile.isShowCurrentTrack(), new LatLon(wpt.lon, wpt.lat), null, null); + SelectedGpxPoint gpxPoint = new SelectedGpxPoint(selectedGpxFile, wpt, null, null, Float.NaN); + TrackMenuFragment.showInstance(mapActivity, selectedGpxFile, gpxPoint, null, null, false); } } } diff --git a/OsmAnd/src/net/osmand/plus/mapcontextmenu/other/TrackDetailsMenu.java b/OsmAnd/src/net/osmand/plus/mapcontextmenu/other/TrackDetailsMenu.java index bf86142181..4ee35b6b36 100644 --- a/OsmAnd/src/net/osmand/plus/mapcontextmenu/other/TrackDetailsMenu.java +++ b/OsmAnd/src/net/osmand/plus/mapcontextmenu/other/TrackDetailsMenu.java @@ -23,7 +23,6 @@ import com.github.mikephil.charting.listener.OnChartGestureListener; import com.github.mikephil.charting.listener.OnChartValueSelectedListener; import net.osmand.AndroidUtils; -import net.osmand.GPXUtilities; import net.osmand.GPXUtilities.GPXFile; import net.osmand.GPXUtilities.GPXTrackAnalysis; import net.osmand.GPXUtilities.TrkSegment; @@ -43,6 +42,7 @@ import net.osmand.plus.helpers.GpxUiHelper; import net.osmand.plus.helpers.GpxUiHelper.GPXDataSetAxisType; import net.osmand.plus.helpers.GpxUiHelper.GPXDataSetType; import net.osmand.plus.helpers.GpxUiHelper.OrderedLineDataSet; +import net.osmand.plus.myplaces.GPXItemPagerAdapter; import net.osmand.plus.views.layers.GPXLayer; import net.osmand.plus.views.mapwidgets.MapInfoWidgetsFactory; import net.osmand.plus.views.mapwidgets.MapInfoWidgetsFactory.TopToolbarController; @@ -299,18 +299,7 @@ public class TrackDetailsMenu { List ds = lineData != null ? lineData.getDataSets() : null; GpxDisplayItem gpxItem = getGpxItem(); if (ds != null && ds.size() > 0 && gpxItem != null) { - for (GPXUtilities.Track t : gpxItem.group.getGpx().tracks) { - for (TrkSegment s : t.segments) { - if (s.points.size() > 0 && s.points.get(0).equals(gpxItem.analysis.locationStart)) { - segment = s; - break; - } - } - if (segment != null) { - break; - } - } - this.segment = segment; + this.segment = GPXItemPagerAdapter.getSegmentForAnalysis(gpxItem, gpxItem.analysis); } } return segment; @@ -755,21 +744,21 @@ public class TrackDetailsMenu { final List availableTypes = new ArrayList<>(); boolean hasSlopeChart = false; if (analysis.hasElevationData) { - availableTypes.add(new GPXDataSetType[]{GPXDataSetType.ALTITUDE}); + availableTypes.add(new GPXDataSetType[] {GPXDataSetType.ALTITUDE}); if (gpxItem.chartAxisType != GPXDataSetAxisType.TIME && gpxItem.chartAxisType != GPXDataSetAxisType.TIMEOFDAY) { - availableTypes.add(new GPXDataSetType[]{GPXDataSetType.SLOPE}); + availableTypes.add(new GPXDataSetType[] {GPXDataSetType.SLOPE}); } } if (analysis.hasSpeedData) { - availableTypes.add(new GPXDataSetType[]{GPXDataSetType.SPEED}); + availableTypes.add(new GPXDataSetType[] {GPXDataSetType.SPEED}); } if (analysis.hasElevationData && gpxItem.chartAxisType != GPXDataSetAxisType.TIME && gpxItem.chartAxisType != GPXDataSetAxisType.TIMEOFDAY) { - availableTypes.add(new GPXDataSetType[]{GPXDataSetType.ALTITUDE, GPXDataSetType.SLOPE}); + availableTypes.add(new GPXDataSetType[] {GPXDataSetType.ALTITUDE, GPXDataSetType.SLOPE}); } if (analysis.hasElevationData && analysis.hasSpeedData) { - availableTypes.add(new GPXDataSetType[]{GPXDataSetType.ALTITUDE, GPXDataSetType.SPEED}); + availableTypes.add(new GPXDataSetType[] {GPXDataSetType.ALTITUDE, GPXDataSetType.SPEED}); } for (GPXDataSetType t : gpxItem.chartTypes) { diff --git a/OsmAnd/src/net/osmand/plus/myplaces/GPXItemPagerAdapter.java b/OsmAnd/src/net/osmand/plus/myplaces/GPXItemPagerAdapter.java index 6f5083d8b2..38519a76fe 100644 --- a/OsmAnd/src/net/osmand/plus/myplaces/GPXItemPagerAdapter.java +++ b/OsmAnd/src/net/osmand/plus/myplaces/GPXItemPagerAdapter.java @@ -26,7 +26,6 @@ import com.github.mikephil.charting.listener.OnChartGestureListener; import com.github.mikephil.charting.listener.OnChartValueSelectedListener; import net.osmand.AndroidUtils; -import net.osmand.GPXUtilities; import net.osmand.GPXUtilities.GPXFile; import net.osmand.GPXUtilities.GPXTrackAnalysis; import net.osmand.GPXUtilities.Track; @@ -34,7 +33,6 @@ import net.osmand.GPXUtilities.TrkSegment; import net.osmand.GPXUtilities.WptPt; import net.osmand.plus.GPXDatabase.GpxDataItem; import net.osmand.plus.GpxSelectionHelper.GpxDisplayItem; -import net.osmand.plus.GpxSelectionHelper.SelectedGpxFile; import net.osmand.plus.OsmAndFormatter; import net.osmand.plus.OsmandApplication; import net.osmand.plus.R; @@ -52,7 +50,6 @@ import net.osmand.plus.views.controls.WrapContentHeightViewPager.ViewAtPositionI import net.osmand.util.Algorithms; import net.osmand.util.MapUtils; -import java.io.File; import java.text.DateFormat; import java.text.SimpleDateFormat; import java.util.ArrayList; @@ -181,17 +178,7 @@ public class GPXItemPagerAdapter extends PagerAdapter implements CustomTabProvid LineData lineData = chart.getLineData(); List ds = lineData != null ? lineData.getDataSets() : null; if (ds != null && ds.size() > 0) { - for (GPXUtilities.Track t : gpxItem.group.getGpx().tracks) { - for (TrkSegment s : t.segments) { - if (s.points.size() > 0 && s.points.get(0).equals(analysis.locationStart)) { - segment = s; - break; - } - } - if (segment != null) { - break; - } - } + segment = getSegmentForAnalysis(gpxItem, analysis); } } return segment; @@ -741,6 +728,14 @@ public class GPXItemPagerAdapter extends PagerAdapter implements CustomTabProvid } if (gpxItem.chartHighlightPos != -1) { chart.highlightValue(gpxItem.chartHighlightPos, 0); + } else if (gpxItem.locationOnMap != null) { + LineData lineData = chart.getLineData(); + List ds = lineData != null ? lineData.getDataSets() : null; + if (ds != null && ds.size() > 0) { + OrderedLineDataSet dataSet = (OrderedLineDataSet) ds.get(0); + gpxItem.chartHighlightPos = (float) (gpxItem.locationOnMap.distance / dataSet.getDivX()); + chart.highlightValue(gpxItem.chartHighlightPos, 0); + } } } else { chart.highlightValue(null); @@ -818,18 +813,7 @@ public class GPXItemPagerAdapter extends PagerAdapter implements CustomTabProvid gpxItem.chartTypes[i] = orderedDataSet.getDataSetType(); } if (gpxItem.chartHighlightPos != -1) { - TrkSegment segment = null; - for (Track t : gpxItem.group.getGpx().tracks) { - for (TrkSegment s : t.segments) { - if (s.points.size() > 0 && s.points.get(0).equals(gpxItem.analysis.locationStart)) { - segment = s; - break; - } - } - if (segment != null) { - break; - } - } + TrkSegment segment = getSegmentForAnalysis(gpxItem, gpxItem.analysis); if (segment != null) { OrderedLineDataSet dataSet = (OrderedLineDataSet) dataSets.get(0); float distance = gpxItem.chartHighlightPos * dataSet.getDivX(); @@ -849,7 +833,16 @@ public class GPXItemPagerAdapter extends PagerAdapter implements CustomTabProvid } } - private void openSplitIntervalScreen() { - actionsListener.openSplitInterval(gpxItem, getTrkSegment()); + public static TrkSegment getSegmentForAnalysis(GpxDisplayItem gpxItem, GPXTrackAnalysis analysis) { + for (Track track : gpxItem.group.getGpx().tracks) { + for (TrkSegment segment : track.segments) { + int size = segment.points.size(); + if (size > 0 && segment.points.get(0).equals(analysis.locationStart) + && segment.points.get(size - 1).equals(analysis.locationEnd)) { + return segment; + } + } + } + return null; } } diff --git a/OsmAnd/src/net/osmand/plus/search/QuickSearchListFragment.java b/OsmAnd/src/net/osmand/plus/search/QuickSearchListFragment.java index 89e918284c..410f011154 100644 --- a/OsmAnd/src/net/osmand/plus/search/QuickSearchListFragment.java +++ b/OsmAnd/src/net/osmand/plus/search/QuickSearchListFragment.java @@ -306,7 +306,7 @@ public abstract class QuickSearchListFragment extends OsmAndListFragment { SearchHistoryHelper.getInstance(app).addNewItemToHistory(gpxInfo); File file = new File(app.getAppPath(IndexConstants.GPX_INDEX_DIR), gpxInfo.getFileName()); String path = file.getAbsolutePath(); - TrackMenuFragment.showInstance(mapActivity, path, false, null, null, QuickSearchDialogFragment.TAG); + TrackMenuFragment.showInstance(mapActivity, path, false, null, QuickSearchDialogFragment.TAG); dialogFragment.dismiss(); } diff --git a/OsmAnd/src/net/osmand/plus/track/SegmentsCard.java b/OsmAnd/src/net/osmand/plus/track/SegmentsCard.java index a3ed324543..6cddd3ffec 100644 --- a/OsmAnd/src/net/osmand/plus/track/SegmentsCard.java +++ b/OsmAnd/src/net/osmand/plus/track/SegmentsCard.java @@ -4,11 +4,14 @@ import android.view.View; import android.view.ViewGroup; import androidx.annotation.NonNull; +import androidx.annotation.Nullable; +import net.osmand.GPXUtilities.TrkSegment; import net.osmand.plus.GpxSelectionHelper.GpxDisplayItem; import net.osmand.plus.GpxSelectionHelper.GpxDisplayItemType; import net.osmand.plus.R; import net.osmand.plus.activities.MapActivity; +import net.osmand.plus.mapcontextmenu.controllers.SelectedGpxMenuController.SelectedGpxPoint; import net.osmand.plus.myplaces.GPXItemPagerAdapter; import net.osmand.plus.myplaces.SegmentActionsListener; import net.osmand.plus.myplaces.SegmentGPXAdapter; @@ -23,12 +26,14 @@ public class SegmentsCard extends BaseCard { private TrackDisplayHelper displayHelper; private GpxDisplayItemType[] filterTypes = new GpxDisplayItemType[] {GpxDisplayItemType.TRACK_SEGMENT}; private SegmentActionsListener listener; + private SelectedGpxPoint gpxPoint; public SegmentsCard(@NonNull MapActivity mapActivity, @NonNull TrackDisplayHelper displayHelper, - @NonNull SegmentActionsListener listener) { + @Nullable SelectedGpxPoint gpxPoint, @NonNull SegmentActionsListener listener) { super(mapActivity); - this.displayHelper = displayHelper; this.listener = listener; + this.displayHelper = displayHelper; + this.gpxPoint = gpxPoint; } @Override @@ -42,6 +47,8 @@ public class SegmentsCard extends BaseCard { container.removeAllViews(); List items = TrackDisplayHelper.flatten(displayHelper.getOriginalGroups(filterTypes)); for (GpxDisplayItem displayItem : items) { + updateLocationOnMap(displayItem); + View segmentView = SegmentGPXAdapter.createGpxTabsView(displayHelper, container, listener, nightMode); WrapContentHeightViewPager pager = segmentView.findViewById(R.id.pager); @@ -53,4 +60,16 @@ public class SegmentsCard extends BaseCard { container.addView(segmentView); } } + + private void updateLocationOnMap(GpxDisplayItem item) { + if (gpxPoint != null) { + TrkSegment segment = GPXItemPagerAdapter.getSegmentForAnalysis(item, item.analysis); + if (segment != null && (segment.points.contains(gpxPoint.getSelectedPoint()) + || segment.points.contains(gpxPoint.getPrevPoint()) + && segment.points.contains(gpxPoint.getNextPoint()))) { + item.locationOnMap = gpxPoint.getSelectedPoint(); + listener.onPointSelected(segment, item.locationOnMap.lat, item.locationOnMap.lon); + } + } + } } \ No newline at end of file diff --git a/OsmAnd/src/net/osmand/plus/track/TrackMenuFragment.java b/OsmAnd/src/net/osmand/plus/track/TrackMenuFragment.java index dcb907f483..4e5e6f6e0c 100644 --- a/OsmAnd/src/net/osmand/plus/track/TrackMenuFragment.java +++ b/OsmAnd/src/net/osmand/plus/track/TrackMenuFragment.java @@ -39,6 +39,7 @@ import net.osmand.FileUtils; import net.osmand.FileUtils.RenameCallback; import net.osmand.GPXUtilities.GPXFile; import net.osmand.GPXUtilities.TrkSegment; +import net.osmand.GPXUtilities.WptPt; import net.osmand.Location; import net.osmand.PlatformUtil; import net.osmand.data.LatLon; @@ -66,6 +67,7 @@ import net.osmand.plus.helpers.AndroidUiHelper; import net.osmand.plus.helpers.GpxUiHelper; import net.osmand.plus.mapcontextmenu.MapContextMenu; import net.osmand.plus.mapcontextmenu.controllers.SelectedGpxMenuController.OpenGpxDetailsTask; +import net.osmand.plus.mapcontextmenu.controllers.SelectedGpxMenuController.SelectedGpxPoint; import net.osmand.plus.mapcontextmenu.other.TrackChartPoints; import net.osmand.plus.mapcontextmenu.other.TrackDetailsMenu; import net.osmand.plus.measurementtool.GpxData; @@ -154,6 +156,7 @@ public class TrackMenuFragment extends ContextMenuScrollFragment implements Card private String gpxTitle; private String returnScreenName; private String callingFragmentTag; + private SelectedGpxPoint gpxPoint; private TrackChartPoints trackChartPoints; private Float heading; @@ -320,6 +323,14 @@ public class TrackMenuFragment extends ContextMenuScrollFragment implements Card this.callingFragmentTag = callingFragmentTag; } + public void setGpxPoint(SelectedGpxPoint point) { + this.gpxPoint = point; + } + + public void setAdjustMapPosition(boolean adjustMapPosition) { + this.adjustMapPosition = adjustMapPosition; + } + @Override public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View view = super.onCreateView(inflater, container, savedInstanceState); @@ -506,7 +517,7 @@ public class TrackMenuFragment extends ContextMenuScrollFragment implements Card } cardsContainer.addView(segmentsCard.getView()); } else { - segmentsCard = new SegmentsCard(mapActivity, displayHelper, this); + segmentsCard = new SegmentsCard(mapActivity, displayHelper, gpxPoint, this); segmentsCard.setListener(this); cardsContainer.addView(segmentsCard.build(mapActivity)); } @@ -1258,7 +1269,7 @@ public class TrackMenuFragment extends ContextMenuScrollFragment implements Card boolean currentRecording = file == null; String path = file != null ? file.getAbsolutePath() : null; if (context instanceof MapActivity) { - TrackMenuFragment.showInstance((MapActivity) context, path, currentRecording, null, null, null); + TrackMenuFragment.showInstance((MapActivity) context, path, currentRecording, null, null); } else { Bundle bundle = new Bundle(); bundle.putString(TRACK_FILE_NAME, path); @@ -1309,7 +1320,6 @@ public class TrackMenuFragment extends ContextMenuScrollFragment implements Card public static void showInstance(@NonNull MapActivity mapActivity, @Nullable String path, boolean showCurrentTrack, - @Nullable final LatLon latLon, @Nullable final String returnScreenName, @Nullable final String callingFragmentTag) { final WeakReference mapActivityRef = new WeakReference<>(mapActivity); @@ -1318,7 +1328,7 @@ public class TrackMenuFragment extends ContextMenuScrollFragment implements Card public boolean processResult(SelectedGpxFile selectedGpxFile) { MapActivity mapActivity = mapActivityRef.get(); if (mapActivity != null && selectedGpxFile != null) { - showInstance(mapActivity, selectedGpxFile, latLon, returnScreenName, callingFragmentTag, true); + showInstance(mapActivity, selectedGpxFile, null, returnScreenName, callingFragmentTag, true); } return true; } @@ -1327,7 +1337,7 @@ public class TrackMenuFragment extends ContextMenuScrollFragment implements Card public static boolean showInstance(@NonNull MapActivity mapActivity, @NonNull SelectedGpxFile selectedGpxFile, - @Nullable LatLon latLon, + @Nullable SelectedGpxPoint gpxPoint, @Nullable String returnScreenName, @Nullable String callingFragmentTag, boolean adjustMapPosition) { @@ -1341,10 +1351,12 @@ public class TrackMenuFragment extends ContextMenuScrollFragment implements Card fragment.setSelectedGpxFile(selectedGpxFile); fragment.setReturnScreenName(returnScreenName); fragment.setCallingFragmentTag(callingFragmentTag); - fragment.adjustMapPosition = adjustMapPosition; + fragment.setAdjustMapPosition(adjustMapPosition); - if (latLon != null) { - fragment.setLatLon(latLon); + if (gpxPoint != null) { + WptPt wptPt = gpxPoint.getSelectedPoint(); + fragment.setLatLon(new LatLon(wptPt.lat, wptPt.lon)); + fragment.setGpxPoint(gpxPoint); } else { QuadRect rect = selectedGpxFile.getGpxFile().getRect(); LatLon latLonRect = new LatLon(rect.centerY(), rect.centerX()); diff --git a/OsmAnd/src/net/osmand/plus/views/layers/GPXLayer.java b/OsmAnd/src/net/osmand/plus/views/layers/GPXLayer.java index 2171c4fc82..24a6d244bb 100644 --- a/OsmAnd/src/net/osmand/plus/views/layers/GPXLayer.java +++ b/OsmAnd/src/net/osmand/plus/views/layers/GPXLayer.java @@ -1025,7 +1025,7 @@ public class GPXLayer extends OsmandMapLayer implements IContextMenuProvider, IM float bearing = prevPointLocation.bearingTo(nextPointLocation); - return new SelectedGpxPoint(selectedGpxFile, projectionPoint, bearing); + return new SelectedGpxPoint(selectedGpxFile, projectionPoint, prevPoint, nextPoint, bearing); } public static WptPt createProjectionPoint(WptPt prevPoint, WptPt nextPoint, LatLon latLon) { @@ -1113,9 +1113,7 @@ public class GPXLayer extends OsmandMapLayer implements IContextMenuProvider, IM } MapActivity mapActivity = (MapActivity) view.getContext(); SelectedGpxPoint point = (SelectedGpxPoint) object; - WptPt wptPt = point.getSelectedPoint(); - TrackMenuFragment.showInstance(mapActivity, point.getSelectedGpxFile(), - new LatLon(wptPt.lat, wptPt.lon), null, null, false); + TrackMenuFragment.showInstance(mapActivity, point.getSelectedGpxFile(), point, null, null, false); return true; }