public class DPUtil extends Object
Constructor and Description |
---|
DPUtil() |
Modifier and Type | Method and Description |
---|---|
static void |
compression(List<ActivityRecord> originPoints,
List<ActivityRecord> resultPoints,
int start,
int end,
double dMax)
Function: According to the maximum distance limit, the original
trajectory is recursively sampled by the DP method to obtain the
compressed trajectory
|
static double |
distToSegment(ActivityRecord pA,
ActivityRecord pB,
ActivityRecord pX)
Function: use the triangle area (calculated by Helen's formula) equal
method to calculate the distance from point pX to the straight line
determined by points pA and pB
|
static List<ActivityRecord> |
dpAlgorithm(List<ActivityRecord> originPoints,
Double dMax)
DP algorithm entry Pass in the set of track points before compression
Output the compressed result track point collection
|
static double |
geoDist(ActivityRecord pA,
ActivityRecord pB)
Function: Find the distance between two latitude and longitude points
according to mathematical formulas
|
static double |
Rad(double d)
Function: angle to radians
|
public static List<ActivityRecord> dpAlgorithm(List<ActivityRecord> originPoints, Double dMax)
originPoints
- The collection of track points before compressiondMax
- Maximum distance error threshold from point to trackpublic static void compression(List<ActivityRecord> originPoints, List<ActivityRecord> resultPoints, int start, int end, double dMax)
originPoints:
- the original latitude and longitude coordinate point
arrayresultPoints:
- keep the filtered point coordinate arraystart:
- starting subscriptend:
- end subscriptdMax:
- pre-specified maximum distance error calculationpublic static double distToSegment(ActivityRecord pA, ActivityRecord pB, ActivityRecord pX)
pA:
- starting pointpB:
- end pointpX:
- The third pointpublic static double geoDist(ActivityRecord pA, ActivityRecord pB)
pA:
- starting pointpB:
- end pointpublic static double Rad(double d)
d:
- angleCopyright © 2020. All rights reserved.