19 package org.sleuthkit.datamodel.blackboardutils.attributes;
21 import com.google.gson.Gson;
22 import com.google.gson.annotations.SerializedName;
23 import java.util.ArrayList;
24 import java.util.Iterator;
25 import java.util.List;
26 import java.util.stream.Collectors;
46 throw new IllegalArgumentException(
"toAttribute was passed a null list");
57 if (attribute == null) {
58 throw new IllegalArgumentException(
"fromAttribute was passed a null attribute");
63 throw new IllegalArgumentException(String.format(
"Invalid attribute of type %s passed to fromAttribute method. Attribute of type TSK_GEO_TRACKPOINTS is required", type.getDisplayName()));
77 if (json == null || json.isEmpty()) {
78 throw new IllegalArgumentException(
"fromJSON was passed a empty or null JSON string");
92 if (trackPoints == null) {
93 throw new IllegalArgumentException(
"toJSON was passed a null track points list");
96 Gson gson =
new Gson();
97 return gson.toJson(trackPoints);
107 private final List<GeoTrackPoint> pointList;
113 pointList =
new ArrayList<>();
122 if (trackPoint == null) {
123 throw new IllegalArgumentException(
"addPoint was passed a null track point");
126 pointList.add(trackPoint);
131 return pointList.iterator();
140 return pointList.isEmpty();
151 List<GeoTrackPoint> orderedPoints = getTimeOrderedPoints();
152 if (orderedPoints != null) {
154 if (point.getTimeStamp() != null) {
155 return point.getTimeStamp();
170 List<GeoTrackPoint> orderedPoints = getTimeOrderedPoints();
171 if (orderedPoints != null) {
172 for (
int index = orderedPoints.size() - 1; index >= 0; index--) {
188 private List<GeoTrackPoint> getTimeOrderedPoints() {
189 return pointList.stream().sorted().collect(Collectors.toCollection(ArrayList::new));
199 @SerializedName(
"TSK_GEO_VELOCITY")
200 private final Double velocity;
201 @SerializedName(
"TSK_DISTANCE_FROM_HOMEPOINT")
202 private final Double distanceFromHomePoint;
203 @SerializedName(
"TSK_DISTANCE_TRAVELED")
204 private final Double distanceTraveled;
205 @SerializedName(
"TSK_DATETIME")
206 private final Long timestamp;
237 Double distanceFromHomePoint,
238 Double distanceTraveled,
240 super(latitude, longitude, altitude, name);
241 this.velocity = velocity;
242 this.distanceFromHomePoint = distanceFromHomePoint;
243 this.distanceTraveled = distanceTraveled;
244 this.timestamp = timestamp;
264 return distanceFromHomePoint;
274 return distanceTraveled;
291 if (timestamp == null && otherTimeStamp != null) {
293 }
else if (timestamp != null && otherTimeStamp == null) {
static ATTRIBUTE_TYPE fromID(int typeID)
Double getDistanceTraveled()
int compareTo(GeoTrackPoint otherTP)
GeoTrackPoint(Double latitude, Double longitude, Double altitude, String name, Double velocity, Double distanceFromHomePoint, Double distanceTraveled, Long timestamp)
BlackboardAttribute toAttribute(String moduleName, GeoTrackPointList value)
BlackboardAttribute.Type getAttributeType()
Iterator< GeoTrackPoint > iterator()
Double getDistanceFromHomePoint()
GeoTrackPointList fromAttribute(BlackboardAttribute attribute)
void addPoint(GeoTrackPoint trackPoint)