Search in sources :

Example 1 with GpxSplitType

use of net.osmand.plus.track.GpxSplitType in project Osmand by osmandapp.

the class TrackAppearanceFragment method discardSplitChanges.

private void discardSplitChanges() {
    if (gpxDataItem != null && (gpxDataItem.getSplitType() != trackDrawInfo.getSplitType() || gpxDataItem.getSplitInterval() != trackDrawInfo.getSplitInterval())) {
        int timeSplit = (int) gpxDataItem.getSplitInterval();
        double distanceSplit = gpxDataItem.getSplitInterval();
        GpxSplitType splitType = GpxSplitType.getSplitTypeByTypeId(gpxDataItem.getSplitType());
        applySplit(splitType, timeSplit, distanceSplit);
    }
}
Also used : GpxSplitType(net.osmand.plus.track.GpxSplitType)

Example 2 with GpxSplitType

use of net.osmand.plus.track.GpxSplitType in project Osmand by osmandapp.

the class GpxSelectionHelper method processSplit.

@NonNull
public static List<GpxDisplayGroup> processSplit(@NonNull OsmandApplication app, @NonNull GpxDataItem dataItem, @NonNull GPXFile gpxFile) {
    List<GpxDisplayGroup> groups = app.getSelectedGpxHelper().collectDisplayGroups(gpxFile);
    GpxSplitType splitType = GpxSplitType.getSplitTypeByTypeId(dataItem.getSplitType());
    if (splitType == GpxSplitType.NO_SPLIT) {
        for (GpxDisplayGroup model : groups) {
            model.noSplit(app);
        }
    } else if (splitType == GpxSplitType.DISTANCE) {
        for (GpxDisplayGroup model : groups) {
            model.splitByDistance(app, dataItem.getSplitInterval(), dataItem.isJoinSegments());
        }
    } else if (splitType == GpxSplitType.TIME) {
        for (GpxDisplayGroup model : groups) {
            model.splitByTime(app, (int) dataItem.getSplitInterval(), dataItem.isJoinSegments());
        }
    }
    return groups;
}
Also used : GpxSplitType(net.osmand.plus.track.GpxSplitType) NonNull(androidx.annotation.NonNull)

Example 3 with GpxSplitType

use of net.osmand.plus.track.GpxSplitType in project Osmand by osmandapp.

the class GpxSettingsItem method updateGpxParams.

private void updateGpxParams(@NonNull GpxDataItem dataItem) {
    GpxDbHelper gpxDbHelper = app.getGpxDbHelper();
    GpxSplitType splitType = GpxSplitType.getSplitTypeByTypeId(appearanceInfo.splitType);
    gpxDbHelper.updateColor(dataItem, appearanceInfo.color);
    gpxDbHelper.updateWidth(dataItem, appearanceInfo.width);
    gpxDbHelper.updateShowArrows(dataItem, appearanceInfo.showArrows);
    gpxDbHelper.updateShowStartFinish(dataItem, appearanceInfo.showStartFinish);
    gpxDbHelper.updateSplit(dataItem, splitType, appearanceInfo.splitInterval);
    gpxDbHelper.updateColoringType(dataItem, appearanceInfo.coloringType);
}
Also used : GpxSplitType(net.osmand.plus.track.GpxSplitType) GpxDbHelper(net.osmand.plus.track.helpers.GpxDbHelper)

Example 4 with GpxSplitType

use of net.osmand.plus.track.GpxSplitType in project Osmand by osmandapp.

the class TrackAppearanceFragment method saveTrackInfo.

private void saveTrackInfo() {
    GPXFile gpxFile = selectedGpxFile.getGpxFile();
    if (gpxFile.showCurrentTrack) {
        settings.CURRENT_TRACK_COLOR.set(trackDrawInfo.getColor());
        settings.CURRENT_TRACK_COLORING_TYPE.set(trackDrawInfo.getColoringType());
        settings.CURRENT_TRACK_ROUTE_INFO_ATTRIBUTE.set(trackDrawInfo.getRouteInfoAttribute());
        settings.CURRENT_TRACK_WIDTH.set(trackDrawInfo.getWidth());
        settings.CURRENT_TRACK_SHOW_ARROWS.set(trackDrawInfo.isShowArrows());
        settings.CURRENT_TRACK_SHOW_START_FINISH.set(trackDrawInfo.isShowStartFinish());
    } else if (gpxDataItem != null) {
        GpxSplitType splitType = GpxSplitType.getSplitTypeByTypeId(trackDrawInfo.getSplitType());
        gpxDbHelper.updateColor(gpxDataItem, trackDrawInfo.getColor());
        gpxDbHelper.updateWidth(gpxDataItem, trackDrawInfo.getWidth());
        gpxDbHelper.updateShowArrows(gpxDataItem, trackDrawInfo.isShowArrows());
        // gpxDbHelper.updateShowStartFinish(gpxDataItem, trackDrawInfo.isShowStartFinish());
        gpxDbHelper.updateSplit(gpxDataItem, splitType, trackDrawInfo.getSplitInterval());
        ColoringType coloringType = trackDrawInfo.getColoringType();
        String routeInfoAttribute = trackDrawInfo.getRouteInfoAttribute();
        gpxDbHelper.updateColoringType(gpxDataItem, coloringType.getName(routeInfoAttribute));
    }
}
Also used : ColoringType(net.osmand.plus.routing.ColoringType) GpxSplitType(net.osmand.plus.track.GpxSplitType) GPXFile(net.osmand.GPXUtilities.GPXFile)

Aggregations

GpxSplitType (net.osmand.plus.track.GpxSplitType)4 NonNull (androidx.annotation.NonNull)1 GPXFile (net.osmand.GPXUtilities.GPXFile)1 ColoringType (net.osmand.plus.routing.ColoringType)1 GpxDbHelper (net.osmand.plus.track.helpers.GpxDbHelper)1