Search in sources :

Example 16 with SelectedGpxFile

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));
        }
    }
}
Also used : Bitmap(android.graphics.Bitmap) SelectedGpxFile(net.osmand.plus.GpxSelectionHelper.SelectedGpxFile) Canvas(android.graphics.Canvas) BitmapDrawable(android.graphics.drawable.BitmapDrawable)

Example 17 with SelectedGpxFile

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));
    }
}
Also used : GpxDisplayGroup(net.osmand.plus.GpxSelectionHelper.GpxDisplayGroup) SelectedGpxFile(net.osmand.plus.GpxSelectionHelper.SelectedGpxFile) SwitchCompat(android.support.v7.widget.SwitchCompat)

Example 18 with SelectedGpxFile

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;
}
Also used : SelectedGpxFile(net.osmand.plus.GpxSelectionHelper.SelectedGpxFile) GpxDataItem(net.osmand.plus.GPXDatabase.GpxDataItem) GPXTrackAnalysis(net.osmand.plus.GPXUtilities.GPXTrackAnalysis) Nullable(android.support.annotation.Nullable)

Example 19 with SelectedGpxFile

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;
}
Also used : OsmandApplication(net.osmand.plus.OsmandApplication) SelectedGpxFile(net.osmand.plus.GpxSelectionHelper.SelectedGpxFile) SelectedGpxFile(net.osmand.plus.GpxSelectionHelper.SelectedGpxFile) GPXFile(net.osmand.plus.GPXUtilities.GPXFile) File(java.io.File) Nullable(android.support.annotation.Nullable)

Example 20 with SelectedGpxFile

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();
}
Also used : OsmandApplication(net.osmand.plus.OsmandApplication) MapMarkersHelper(net.osmand.plus.MapMarkersHelper) SelectedGpxFile(net.osmand.plus.GpxSelectionHelper.SelectedGpxFile) MapMarkersGroup(net.osmand.plus.MapMarkersHelper.MapMarkersGroup) GpxSelectionHelper(net.osmand.plus.GpxSelectionHelper) SelectedGpxFile(net.osmand.plus.GpxSelectionHelper.SelectedGpxFile) GPXFile(net.osmand.plus.GPXUtilities.GPXFile) File(java.io.File)

Aggregations

SelectedGpxFile (net.osmand.plus.GpxSelectionHelper.SelectedGpxFile)35 GPXFile (net.osmand.plus.GPXUtilities.GPXFile)18 File (java.io.File)13 ArrayList (java.util.ArrayList)9 View (android.view.View)7 GpxSelectionHelper (net.osmand.plus.GpxSelectionHelper)7 OsmandApplication (net.osmand.plus.OsmandApplication)7 ImageView (android.widget.ImageView)6 TextView (android.widget.TextView)6 GpxDataItem (net.osmand.plus.GPXDatabase.GpxDataItem)6 WptPt (net.osmand.plus.GPXUtilities.WptPt)6 Paint (android.graphics.Paint)5 AdapterView (android.widget.AdapterView)4 ArrayAdapter (android.widget.ArrayAdapter)4 GpxDisplayGroup (net.osmand.plus.GpxSelectionHelper.GpxDisplayGroup)4 SuppressLint (android.annotation.SuppressLint)3 DialogInterface (android.content.DialogInterface)3 AlertDialog (android.support.v7.app.AlertDialog)3 ViewGroup (android.view.ViewGroup)3 CompoundButton (android.widget.CompoundButton)3