Skip to content

GeoStayFilter

roosit edited this page Nov 15, 2026 · 1 revision

GeoStayFilter

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 GeoStayFilter.java: the production code stays clean and the explanations live in the wiki.

package com.velitask.plugin.official.processing.filters;

import com.velitask.sdk.data.GeoSensorAtom;
import org.abricos.geo.GeoUtils;

/* Stop straightening for GPS coordinates. */
public final class GeoStayFilter extends StayFilter<GeoSensorAtom> {

    /* Stable step name in the plans and settings. */
    public static final String NAME = "geoStay";

    public GeoStayFilter() {
        /* Step version is 1; the sensor atom is GeoSensorAtom. */
        super(NAME, 1, GeoSensorAtom.class);
    }

    @Override
    /* Distance between points on the surface of the Earth in metres. */
    protected double distanceMeters(GeoSensorAtom from, GeoSensorAtom to) {
        return GeoUtils.distance(from.lat, to.lat, from.lon, to.lon);
    }

    @Override
    /* Moves the coordinates of the anchor to the stop point: latitude and longitude. */
    protected void copyValue(GeoSensorAtom from, GeoSensorAtom to) {
        to.lat = from.lat;
        to.lon = from.lon;
    }
}

Purpose

GeoStayFilter is the "Stop at a single point: GPS" step. While the coordinates stay within the radius for longer than the given time, it moves all points of the stop to its first point, so that the track does not draw a "tangle" in place. The algorithm and the radiusMeters and minStaySec parameters are in StayFilter; the class only defines the distance and the copied fields.

How it works

  • Name and version: geoStay, version 1; the atom is GeoSensorAtom.
  • distanceMeters — GeoUtils.distance(from.lat, to.lat, from.lon, to.lon): the distance between points in metres.
  • copyValue — to.lat = from.lat; to.lon = from.lon. Only the coordinates are copied; the other atom fields (time, duration, segment) do not change, and the increments are recalculated by relink in the base class.

Features and limitations

  • The step is registered in BuiltinScenarios, but it is not included in the import plans: at a stop the pause is set by the separate step GeoStayGaps, and this filter remains a sample for plugin authors and for manual scenario setup.
  • With radiusMeters = 0 only the points with the same coordinates are moved, that is, the track does not change.

Clone this wiki locally