use of net.osmand.plus.GpxSelectionHelper.SelectedGpxFile in project Osmand by osmandapp.
the class TrackSegmentFragment method refreshTrackBitmap.
private void refreshTrackBitmap() {
currentTrackColor = app.getSettings().CURRENT_TRACK_COLOR.get();
if (mapBitmap != null) {
SelectedGpxFile sf;
if (getGpx().showCurrentTrack) {
sf = app.getSavingTrackHelper().getCurrentTrack();
} else {
sf = new SelectedGpxFile();
sf.setGpxFile(getGpx());
}
Bitmap bmp = mapBitmap.copy(mapBitmap.getConfig(), true);
Canvas canvas = new Canvas(bmp);
drawTrack(canvas, rotatedTileBox, sf);
drawPoints(canvas, rotatedTileBox, sf);
mapTrackBitmap = bmp;
Bitmap selectedPointBitmap = drawSelectedPoint();
if (selectedPointBitmap != null) {
imageView.setImageDrawable(new BitmapDrawable(app.getResources(), selectedPointBitmap));
} else {
imageView.setImageDrawable(new BitmapDrawable(app.getResources(), mapTrackBitmap));
}
}
}
use of net.osmand.plus.GpxSelectionHelper.SelectedGpxFile in project Osmand by osmandapp.
the class TrackSegmentFragment method updateSplitView.
public void updateSplitView() {
if (getGpx() != null) {
SelectedGpxFile sf = app.getSelectedGpxHelper().selectGpxFile(getGpx(), ((SwitchCompat) headerView.findViewById(R.id.showOnMapToggle)).isChecked(), false);
final List<GpxDisplayGroup> groups = getDisplayGroups();
if (groups.size() > 0) {
updateSplit(groups, ((SwitchCompat) headerView.findViewById(R.id.showOnMapToggle)).isChecked() ? sf : null);
if (getGpxDataItem() != null) {
updateSplitInDatabase();
}
}
updateSplitIntervalView(headerView.findViewById(R.id.split_interval_view));
}
}
use of net.osmand.plus.GpxSelectionHelper.SelectedGpxFile in project Osmand by osmandapp.
the class AvailableGPXFragment method getGpxTrackAnalysis.
@Nullable
private static GPXTrackAnalysis getGpxTrackAnalysis(GpxInfo gpxInfo, OsmandApplication app) {
SelectedGpxFile sgpx = getSelectedGpxFile(gpxInfo, app);
GPXTrackAnalysis analysis = null;
if (sgpx != null) {
analysis = sgpx.getTrackAnalysis();
} else if (gpxInfo.currentlyRecordingTrack) {
analysis = app.getSavingTrackHelper().getCurrentTrack().getTrackAnalysis();
} else {
GpxDataItem dataItem = gpxInfo.file == null ? null : app.getGpxDatabase().getItem(gpxInfo.file);
if (dataItem != null) {
analysis = dataItem.getAnalysis();
}
}
return analysis;
}
use of net.osmand.plus.GpxSelectionHelper.SelectedGpxFile in project Osmand by osmandapp.
the class SelectWptCategoriesBottomSheetDialogFragment method getGpxFile.
@Nullable
private GPXFile getGpxFile() {
String filePath = getArguments().getString(GPX_FILE_PATH_KEY);
if (filePath != null) {
OsmandApplication app = getMyApplication();
SelectedGpxFile selectedGpx = app.getSelectedGpxHelper().getSelectedFileByPath(filePath);
if (selectedGpx != null && selectedGpx.getGpxFile() != null) {
return selectedGpx.getGpxFile();
}
return GPXUtilities.loadGPXFile(app, new File(filePath));
}
return null;
}
use of net.osmand.plus.GpxSelectionHelper.SelectedGpxFile in project Osmand by osmandapp.
the class SelectWptCategoriesBottomSheetDialogFragment method onRightBottomButtonClick.
@Override
protected void onRightBottomButtonClick() {
OsmandApplication app = getMyApplication();
GpxSelectionHelper gpxSelectionHelper = app.getSelectedGpxHelper();
MapMarkersHelper mapMarkersHelper = app.getMapMarkersHelper();
SelectedGpxFile selectedGpxFile = gpxSelectionHelper.getSelectedFileByPath(gpxFile.path);
if (selectedGpxFile == null) {
gpxSelectionHelper.selectGpxFile(gpxFile, true, false);
}
MapMarkersGroup markersGr = mapMarkersHelper.getOrCreateGroup(new File(gpxFile.path));
mapMarkersHelper.updateGroupWptCategories(markersGr, selectedCategories);
mapMarkersHelper.addOrEnableGroup(markersGr);
dismiss();
}
Aggregations