Skip to content
Snippets Groups Projects
Commit 02de2810 authored by Rico Possienka's avatar Rico Possienka
Browse files

skip datapoints that are to close

parent 8aaa140e
No related branches found
No related tags found
No related merge requests found
...@@ -14,6 +14,7 @@ public class DataPointVisualize : MonoBehaviour ...@@ -14,6 +14,7 @@ public class DataPointVisualize : MonoBehaviour
public TextAsset data; public TextAsset data;
public GameObject dataPathPrefab; public GameObject dataPathPrefab;
public int dataLimit = 1000; public int dataLimit = 1000;
public float minDistance = 0.01f;
ILocationProvider _locationProvider; ILocationProvider _locationProvider;
ILocationProvider LocationProvider ILocationProvider LocationProvider
...@@ -44,17 +45,21 @@ public class DataPointVisualize : MonoBehaviour ...@@ -44,17 +45,21 @@ public class DataPointVisualize : MonoBehaviour
} }
//objs.Sort(Comparer<DataPath.DataPoint>.Create((l,r) => l.direction - r.direction)); //objs.Sort(Comparer<DataPath.DataPoint>.Create((l,r) => l.direction - r.direction));
//objs.Sort(Comparer<DataPath.DataPoint>.Create((l,r) => isign(l.timestamp - r.timestamp))); objs.Sort(Comparer<DataPath.DataPoint>.Create((l,r) => isign(l.timestamp - r.timestamp)));
//objs.Sort(Comparer<DataPath.DataPoint>.Create((l,r) => l.id.GetHashCode() - r.id.GetHashCode())); //objs.Sort(Comparer<DataPath.DataPoint>.Create((l,r) => l.id.GetHashCode() - r.id.GetHashCode()));
objs.Sort(Comparer<DataPath.DataPoint>.Create((l,r) => l.id.CompareTo(r.id))); objs.Sort(Comparer<DataPath.DataPoint>.Create((l,r) => l.id.CompareTo(r.id)));
int lastID = "".GetHashCode(); int lastID = "".GetHashCode();
DataPath path = null; DataPath path = null;
int pathCount = 0; int pathCount = 0;
double lastLat = 0;
double lastLon = 0;
int savedPoints = 0;
int effectivePoints = 0;
for (int i = 0; i < objs.Count; i++) for (int i = 0; i < objs.Count; i++)
{ {
var point = objs[i]; DataPath.DataPoint point = objs[i];
if(lastID != point.id.GetHashCode()) { if(lastID != point.id.GetHashCode()) {
...@@ -77,14 +82,24 @@ public class DataPointVisualize : MonoBehaviour ...@@ -77,14 +82,24 @@ public class DataPointVisualize : MonoBehaviour
pathCount++; pathCount++;
} }
path.points.Add(point); if (Math.Abs(lastLat - point.lat) > minDistance && Math.Abs(lastLon - point.lon) > minDistance)
{
path.points.Add(point);
lastLat = point.lat;
lastLon = point.lon;
++effectivePoints;
}
else {
++savedPoints;
}
} }
path.Setup(); path.Setup();
Debug.Log("dataPath count = " + GameObject.FindObjectsOfType<DataPath>().Length); Debug.Log("dataPath count = " + GameObject.FindObjectsOfType<DataPath>().Length);
Debug.Log("saved points = " + savedPoints);
Debug.Log("effective points = " + effectivePoints);
}; };
} }
private int isign(long s) private int isign(long s)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment