Repository navigation
GeoStayFilter
roosit edited this page Nov 15, 2026
·
1 revision
Up | Previous | Next | Русский
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;
}
}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.
-
Name and version:
geoStay, version 1; the atom isGeoSensorAtom. -
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 byrelinkin the base class.
- 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 stepGeoStayGaps, and this filter remains a sample for plugin authors and for manual scenario setup. - With
radiusMeters = 0only the points with the same coordinates are moved, that is, the track does not change.