Skip to content

BuiltinScenarios

roosit edited this page Nov 15, 2026 · 1 revision

BuiltinScenarios

Up | Previous | Next | Русский

Full source with short explanations

Below is the full source of the class in documentation form. The comments inside the block explain the purpose of the parts of the class, but they are not stored in the working file BuiltinScenarios.java: the production code stays clean and the explanations live in the wiki.

package com.velitask.plugin.official.processing;

import java.util.List;
import java.util.function.Supplier;

import com.velitask.plugin.official.processing.compress.AccelToleranceCompress;
import com.velitask.plugin.official.processing.compress.AttitudeToleranceCompress;
import com.velitask.plugin.official.processing.compress.GyroToleranceCompress;
import com.velitask.plugin.official.processing.compress.OrientToleranceCompress;
import com.velitask.plugin.official.processing.compress.SameValueCompress;
import com.velitask.plugin.official.processing.filters.AccelAverageFilter;
import com.velitask.plugin.official.processing.filters.AttitudeAverageFilter;
import com.velitask.plugin.official.processing.filters.CyclingPowerBadPointFilter;
import com.velitask.plugin.official.processing.filters.ElevationBadPointFilter;
import com.velitask.plugin.official.processing.filters.GeoBadPointFilter;
import com.velitask.plugin.official.processing.filters.GeoStayFilter;
import com.velitask.plugin.official.processing.filters.GyroAverageFilter;
import com.velitask.plugin.official.processing.filters.HeartBadPointFilter;
import com.velitask.plugin.official.processing.filters.OrientAverageFilter;
import com.velitask.plugin.official.processing.filters.PowerBalanceBadPointFilter;
import com.velitask.plugin.official.processing.filters.SlopeBadPointFilter;
import com.velitask.plugin.official.processing.filters.SpeedAverageFilter;
import com.velitask.plugin.official.processing.filters.SpeedBadPointFilter;
import com.velitask.plugin.official.processing.filters.SpeedDriftFilter;
import com.velitask.plugin.official.processing.filters.SpeedExponentialFilter;
import com.velitask.plugin.official.processing.gaps.ExplicitGaps;
import com.velitask.plugin.official.processing.gaps.FollowGaps;
import com.velitask.plugin.official.processing.gaps.GeoStayGaps;
import com.velitask.plugin.official.processing.gaps.SpeedThresholdGaps;
import com.velitask.plugin.official.processing.gaps.StepGaps;
import com.velitask.plugin.official.processing.gaps.UnchangedGaps;
import com.velitask.plugin.official.processing.plans.DjiImportPlan;
import com.velitask.plugin.official.processing.plans.DjiSrtImportPlan;
import com.velitask.plugin.official.processing.plans.FitImportPlan;
import com.velitask.plugin.official.processing.plans.GoproImportPlan;
import com.velitask.plugin.official.processing.plans.GpxImportPlan;
import com.velitask.plugin.official.processing.plans.TcxImportPlan;
import com.velitask.plugin.official.processing.plans.TmgImportPlan;
import com.velitask.sdk.scenario.IImportStep;
import com.velitask.sdk.scenario.ImportPlan;

/* Registry of the plugin's built-in steps and import plans; read by VelitaskPlagin. */
public final class BuiltinScenarios {

    /* Utility class: no instances are created. */
    private BuiltinScenarios() {
    }

    /* Step suppliers: a reference to the constructor of each step. */
    public static List<Supplier<? extends IImportStep<?>>> steps() {
        return List.of(
                /* Pauses: by recording gap, from the file, by frozen value, as in the reference sensor, by GPS stop, by speed. */
                StepGaps::new,
                ExplicitGaps::new,
                UnchangedGaps::new,
                FollowGaps::new,
                GeoStayGaps::new,
                SpeedThresholdGaps::new,
                /* Smoothing (speed, acceleration, rotation, orientation, angles), speed drift, GPS stop. */
                SpeedAverageFilter::new,
                SpeedExponentialFilter::new,
                AccelAverageFilter::new,
                GyroAverageFilter::new,
                OrientAverageFilter::new,
                AttitudeAverageFilter::new,
                SpeedDriftFilter::new,
                GeoStayFilter::new,
                /* Bad point rejection: coordinates, heart rate, speed, power, balance, elevation, slope. */
                GeoBadPointFilter::new,
                HeartBadPointFilter::new,
                SpeedBadPointFilter::new,
                CyclingPowerBadPointFilter::new,
                PowerBalanceBadPointFilter::new,
                ElevationBadPointFilter::new,
                SlopeBadPointFilter::new,
                /* Compression: with a tolerance for vector sensors and merging of identical values for the rest. */
                AccelToleranceCompress::new,
                GyroToleranceCompress::new,
                OrientToleranceCompress::new,
                AttitudeToleranceCompress::new,
                SameValueCompress::new
        );
    }

    /* Import plans: one per source format. */
    public static List<ImportPlan> plans() {
        return List.of(
                new GpxImportPlan(),
                new FitImportPlan(),
                new TcxImportPlan(),
                new TmgImportPlan(),
                new GoproImportPlan(),
                new DjiImportPlan(),
                new DjiSrtImportPlan()
        );
    }
}

Purpose

BuiltinScenarios is the single place where the plugin lists everything it gives to the application for processing sensor data on import: steps (processing formulas) and import plans (which steps to apply to which sensors and with which values for each source format). The class itself processes nothing, it only collects the lists.

How it works

Data. Two static methods.

  • steps() returns a list of step suppliers Supplier<? extends IImportStep<?>>: each element is a reference to a step constructor (StepGaps::new, etc.). The list has 26 steps: 6 pause steps (StepGaps, ExplicitGaps, UnchangedGaps, FollowGaps, GeoStayGaps, SpeedThresholdGaps); 8 filters for smoothing, drift and stop (SpeedAverageFilter, SpeedExponentialFilter, AccelAverageFilter, GyroAverageFilter, OrientAverageFilter, AttitudeAverageFilter, SpeedDriftFilter, GeoStayFilter); 7 bad point rejection filters (GeoBadPointFilter, HeartBadPointFilter, SpeedBadPointFilter, CyclingPowerBadPointFilter, PowerBalanceBadPointFilter, ElevationBadPointFilter, SlopeBadPointFilter); 5 compression steps (AccelToleranceCompress, GyroToleranceCompress, OrientToleranceCompress, AttitudeToleranceCompress, SameValueCompress).
  • plans() returns a list of import plans in the order GpxImportPlan, FitImportPlan, TcxImportPlan, TmgImportPlan, GoproImportPlan, DjiImportPlan, DjiSrtImportPlan. Each call creates new plan objects.

Settings. The class has no settings of its own. The step names that the plans refer to are the NAME constants of the steps themselves.

Drawing. Not applicable: the class draws nothing. The lists are given out by VelitaskPlagin: defineImportSteps() returns BuiltinScenarios.steps(), and defineImportPlans() returns BuiltinScenarios.plans(); the application gets them through the IScenarioProvider interface.

Features and limitations

  • The abstract base classes of the formulas (ValueFilter, BadPointFilter, ExponentialFilter, DriftFilter, StayFilter, AverageFilter, VectorAverageFilter, StayGaps, ThresholdGaps, ToleranceCompress) are not needed in the list: only ready steps that have their own name are registered.
  • The order in steps() does not set the order of application: the order of steps for a sensor is determined by the import plan.
  • A plan can refer to a step by a name without a dot only if the step is in steps(): the application looks for such a name among the steps of this plugin.
  • To add a step, create a formula class and add its constructor to steps(); to add a format, create a plan and add it to plans().
  • The class is final, the constructor is private.

Clone this wiki locally