Search in sources :

Example 6 with GpxSelectionHelper

use of net.osmand.plus.GpxSelectionHelper 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)

Example 7 with GpxSelectionHelper

use of net.osmand.plus.GpxSelectionHelper in project Osmand by osmandapp.

the class WptPtMenuBuilder method buildWaypointsView.

private void buildWaypointsView(View view) {
    GpxSelectionHelper gpxSelectionHelper = app.getSelectedGpxHelper();
    SelectedGpxFile selectedGpxFile = gpxSelectionHelper.getSelectedGPXFile(wpt);
    if (selectedGpxFile != null) {
        List<WptPt> points = selectedGpxFile.getGpxFile().getPoints();
        GPXUtilities.GPXFile gpx = selectedGpxFile.getGpxFile();
        if (points.size() > 0) {
            String title = view.getContext().getString(R.string.context_menu_points_of_group);
            File file = new File(gpx.path);
            String gpxName = file.getName().replace(".gpx", "").replace("/", " ").replace("_", " ");
            int color = getPointColor(wpt, getFileColor(selectedGpxFile));
            buildRow(view, app.getIconsCache().getPaintedIcon(R.drawable.ic_type_waypoints_group, color), null, title, 0, gpxName, true, getCollapsableWaypointsView(view.getContext(), true, gpx, wpt), false, 0, false, null, false);
        }
    }
}
Also used : WptPt(net.osmand.plus.GPXUtilities.WptPt) SelectedGpxFile(net.osmand.plus.GpxSelectionHelper.SelectedGpxFile) GpxSelectionHelper(net.osmand.plus.GpxSelectionHelper) SelectedGpxFile(net.osmand.plus.GpxSelectionHelper.SelectedGpxFile) File(java.io.File) GPXUtilities(net.osmand.plus.GPXUtilities)

Example 8 with GpxSelectionHelper

use of net.osmand.plus.GpxSelectionHelper in project Osmand by osmandapp.

the class AddTracksGroupBottomSheetDialogFragment method createMapMarkersSyncGroup.

private MapMarkersGroup createMapMarkersSyncGroup(OsmandApplication app, GpxDataItem gpxDataItem) {
    GpxSelectionHelper gpxSelectionHelper = app.getSelectedGpxHelper();
    File gpx = gpxDataItem.getFile();
    SelectedGpxFile selectedGpxFile = gpxSelectionHelper.getSelectedFileByPath(gpx.getAbsolutePath());
    if (selectedGpxFile == null) {
        GPXFile res = GPXUtilities.loadGPXFile(app, gpx);
        gpxSelectionHelper.selectGpxFile(res, true, false);
    }
    return getMyApplication().getMapMarkersHelper().getOrCreateGroup(gpx);
}
Also used : SelectedGpxFile(net.osmand.plus.GpxSelectionHelper.SelectedGpxFile) GpxSelectionHelper(net.osmand.plus.GpxSelectionHelper) GPXFile(net.osmand.plus.GPXUtilities.GPXFile) SelectedGpxFile(net.osmand.plus.GpxSelectionHelper.SelectedGpxFile) GPXFile(net.osmand.plus.GPXUtilities.GPXFile) File(java.io.File)

Aggregations

GpxSelectionHelper (net.osmand.plus.GpxSelectionHelper)8 SelectedGpxFile (net.osmand.plus.GpxSelectionHelper.SelectedGpxFile)7 File (java.io.File)5 GPXFile (net.osmand.plus.GPXUtilities.GPXFile)3 OsmandApplication (net.osmand.plus.OsmandApplication)2 AsyncTask (android.os.AsyncTask)1 View (android.view.View)1 ImageView (android.widget.ImageView)1 TextView (android.widget.TextView)1 ArrayList (java.util.ArrayList)1 ASelectedGpxFile (net.osmand.aidl.gpx.ASelectedGpxFile)1 AMapPoint (net.osmand.aidl.maplayer.point.AMapPoint)1 FavouritePoint (net.osmand.data.FavouritePoint)1 GpxDataItem (net.osmand.plus.GPXDatabase.GpxDataItem)1 GPXUtilities (net.osmand.plus.GPXUtilities)1 WptPt (net.osmand.plus.GPXUtilities.WptPt)1 GpxDisplayGroup (net.osmand.plus.GpxSelectionHelper.GpxDisplayGroup)1 MapMarkersHelper (net.osmand.plus.MapMarkersHelper)1 MapMarkersGroup (net.osmand.plus.MapMarkersHelper.MapMarkersGroup)1 AvailableGPXFragment (net.osmand.plus.myplaces.AvailableGPXFragment)1