Search in sources :

Example 11 with ColoringType

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

Example 12 with ColoringType

use of net.osmand.plus.routing.ColoringType in project Osmand by osmandapp.

the class TrackAppearanceFragment method isAvailableColoringType.

private boolean isAvailableColoringType() {
    if (trackColoringCard != null) {
        ColoringType currentColoringType = trackColoringCard.getSelectedColoringType();
        String routeInfoAttribute = trackColoringCard.getRouteInfoAttribute();
        return currentColoringType.isAvailableInSubscription(app, routeInfoAttribute, false);
    }
    return false;
}
Also used : ColoringType(net.osmand.plus.routing.ColoringType)

Example 13 with ColoringType

use of net.osmand.plus.routing.ColoringType in project Osmand by osmandapp.

the class GPXDatabase method readItem.

private GpxDataItem readItem(SQLiteCursor query) {
    String fileName = query.getString(0);
    String fileDir = query.getString(1);
    float totalDistance = (float) query.getDouble(2);
    int totalTracks = query.getInt(3);
    long startTime = query.getLong(4);
    long endTime = query.getLong(5);
    long timeSpan = query.getLong(6);
    long timeMoving = query.getLong(7);
    float totalDistanceMoving = (float) query.getDouble(8);
    double diffElevationUp = query.getDouble(9);
    double diffElevationDown = query.getDouble(10);
    double avgElevation = query.getDouble(11);
    double minElevation = query.getDouble(12);
    double maxElevation = query.getDouble(13);
    float maxSpeed = (float) query.getDouble(14);
    float avgSpeed = (float) query.getDouble(15);
    int points = query.getInt(16);
    int wptPoints = query.getInt(17);
    String color = query.getString(18);
    long fileLastModifiedTime = query.getLong(19);
    long fileLastUploadedTime = query.getLong(20);
    int splitType = query.getInt(21);
    double splitInterval = query.getDouble(22);
    boolean apiImported = query.getInt(23) == 1;
    String wptCategoryNames = query.getString(24);
    boolean showAsMarkers = query.getInt(25) == 1;
    boolean joinSegments = query.getInt(26) == 1;
    boolean showArrows = query.getInt(27) == 1;
    boolean showStartFinish = query.getInt(28) == 1;
    String width = query.getString(29);
    String coloringTypeName = query.getString(33);
    double smoothingThreshold = query.getDouble(34);
    double minFilterSpeed = query.getDouble(35);
    double maxFilterSpeed = query.getDouble(36);
    double minFilterAltitude = query.getDouble(37);
    double maxFilterAltitude = query.getDouble(38);
    double maxFilterHdop = query.getDouble(39);
    GPXTrackAnalysis a = new GPXTrackAnalysis();
    a.totalDistance = totalDistance;
    a.totalTracks = totalTracks;
    a.startTime = startTime;
    a.endTime = endTime;
    a.timeSpan = timeSpan;
    a.timeMoving = timeMoving;
    a.totalDistanceMoving = totalDistanceMoving;
    a.diffElevationUp = diffElevationUp;
    a.diffElevationDown = diffElevationDown;
    a.avgElevation = avgElevation;
    a.minElevation = minElevation;
    a.maxElevation = maxElevation;
    a.minSpeed = maxSpeed;
    a.maxSpeed = maxSpeed;
    a.avgSpeed = avgSpeed;
    a.points = points;
    a.wptPoints = wptPoints;
    if (wptCategoryNames != null) {
        a.wptCategoryNames = Algorithms.decodeStringSet(wptCategoryNames);
    }
    File dir;
    if (!Algorithms.isEmpty(fileDir)) {
        dir = new File(context.getAppPath(IndexConstants.GPX_INDEX_DIR), fileDir);
    } else {
        dir = context.getAppPath(IndexConstants.GPX_INDEX_DIR);
    }
    GpxDataItem item = new GpxDataItem(new File(dir, fileName), a);
    item.color = parseColor(color);
    item.fileLastModifiedTime = fileLastModifiedTime;
    item.fileLastUploadedTime = fileLastUploadedTime;
    item.splitType = splitType;
    item.splitInterval = splitInterval;
    item.apiImported = apiImported;
    item.showAsMarkers = showAsMarkers;
    item.joinSegments = joinSegments;
    item.showArrows = showArrows;
    item.showStartFinish = showStartFinish;
    item.width = width;
    if (ColoringType.getNullableTrackColoringTypeByName(coloringTypeName) != null) {
        item.coloringType = coloringTypeName;
    } else if (GradientScaleType.getGradientTypeByName(coloringTypeName) != null) {
        GradientScaleType scaleType = GradientScaleType.getGradientTypeByName(coloringTypeName);
        ColoringType coloringType = ColoringType.fromGradientScaleType(scaleType);
        item.coloringType = coloringType == null ? null : coloringType.getName(null);
    }
    item.smoothingThreshold = smoothingThreshold;
    item.minFilterSpeed = minFilterSpeed;
    item.maxFilterSpeed = maxFilterSpeed;
    item.minFilterAltitude = minFilterAltitude;
    item.maxFilterAltitude = maxFilterAltitude;
    item.maxFilterHdop = maxFilterHdop;
    return item;
}
Also used : ColoringType(net.osmand.plus.routing.ColoringType) GPXTrackAnalysis(net.osmand.GPXUtilities.GPXTrackAnalysis) GPXFile(net.osmand.GPXUtilities.GPXFile) File(java.io.File) GradientScaleType(net.osmand.plus.track.GradientScaleType)

Aggregations

ColoringType (net.osmand.plus.routing.ColoringType)13 GPXFile (net.osmand.GPXUtilities.GPXFile)4 Paint (android.graphics.Paint)2 File (java.io.File)2 ArrayList (java.util.ArrayList)2 GPXTrackAnalysis (net.osmand.GPXUtilities.GPXTrackAnalysis)2 TrkSegment (net.osmand.GPXUtilities.TrkSegment)2 QuadRect (net.osmand.data.QuadRect)2 MapActivity (net.osmand.plus.activities.MapActivity)2 SelectedGpxPoint (net.osmand.plus.mapcontextmenu.controllers.SelectedGpxMenuController.SelectedGpxPoint)2 GradientScaleType (net.osmand.plus.track.GradientScaleType)2 DirectionArrowsCard (net.osmand.plus.track.cards.DirectionArrowsCard)2 SplitIntervalCard (net.osmand.plus.track.cards.SplitIntervalCard)2 TrackColoringCard (net.osmand.plus.track.cards.TrackColoringCard)2 TrackWidthCard (net.osmand.plus.track.cards.TrackWidthCard)2 SelectedGpxFile (net.osmand.plus.track.helpers.GpxSelectionHelper.SelectedGpxFile)2 View (android.view.View)1 ViewGroup (android.view.ViewGroup)1 ImageView (android.widget.ImageView)1 ScrollView (android.widget.ScrollView)1