20 package org.sleuthkit.autopsy.geolocation.datamodel;
22 import java.util.Collections;
23 import java.util.HashMap;
24 import java.util.List;
26 import org.openide.util.NbBundle.Messages;
29 import org.
sleuthkit.datamodel.blackboardutils.attributes.BlackboardJsonAttrUtil;
30 import org.
sleuthkit.datamodel.blackboardutils.attributes.BlackboardJsonAttrUtil.InvalidJsonException;
31 import org.
sleuthkit.datamodel.blackboardutils.attributes.GeoWaypoints;
55 "Route_Label=As-the-crow-flies Route"
58 super(
artifact, Bundle.Route_Label());
60 Map<BlackboardAttribute.ATTRIBUTE_TYPE, BlackboardAttribute> attributeMap =
Waypoint.getAttributesFromArtifactAsMap(
artifact);
62 BlackboardAttribute attribute = attributeMap.get(BlackboardAttribute.ATTRIBUTE_TYPE.TSK_DATETIME);
63 timestamp = attribute != null ? attribute.getValueLong() : null;
108 "Route_point_label=Waypoints for route"
111 BlackboardAttribute attribute = attributeMap.get(BlackboardAttribute.ATTRIBUTE_TYPE.TSK_GEO_WAYPOINTS);
114 if (label == null || label.isEmpty()) {
115 label = Bundle.Route_point_label();
117 label = String.format(
"%s: %s", Bundle.Route_point_label(), label);
120 if (attribute != null) {
121 GeoWaypoints waypoints;
123 waypoints = BlackboardJsonAttrUtil.fromAttribute(attribute, GeoWaypoints.class);
124 }
catch (InvalidJsonException ex) {
125 throw new GeoLocationDataException(String.format(
"Unable to parse waypoints in TSK_GEO_WAYPOINTS attribute (artifact object ID =%d)", artifact.getId()), ex);
127 for (GeoWaypoints.Waypoint waypoint : waypoints) {
128 String name = waypoint.getName();
129 Map<BlackboardAttribute.ATTRIBUTE_TYPE, BlackboardAttribute> map = attributeMap;
130 if(name != null && !name.isEmpty()) {
131 BlackboardAttribute pointNameAtt =
new BlackboardAttribute(BlackboardAttribute.ATTRIBUTE_TYPE.TSK_LOCATION,
"", name);
132 map =
new HashMap<>(attributeMap);
133 map.put(BlackboardAttribute.ATTRIBUTE_TYPE.TSK_LOCATION, pointNameAtt);
135 addToPath(
new Waypoint(artifact, label, timestamp, waypoint.getLatitude(), waypoint.getLongitude(), waypoint.getAltitude(), null, map,
this));
159 "Route_Start_Label=Start"
163 BlackboardAttribute latitude = attributeMap.get(BlackboardAttribute.ATTRIBUTE_TYPE.TSK_GEO_LATITUDE_START);
164 BlackboardAttribute longitude = attributeMap.get(BlackboardAttribute.ATTRIBUTE_TYPE.TSK_GEO_LONGITUDE_START);
165 BlackboardAttribute altitude = attributeMap.get(BlackboardAttribute.ATTRIBUTE_TYPE.TSK_GEO_ALTITUDE);
167 if (latitude != null && longitude != null) {
169 Bundle.Route_Start_Label(),
171 latitude.getValueDouble(),
172 longitude.getValueDouble(),
173 altitude != null ? altitude.getValueDouble() : null,
194 "Route_End_Label=End"
197 BlackboardAttribute latitude = attributeMap.get(BlackboardAttribute.ATTRIBUTE_TYPE.TSK_GEO_LATITUDE_END);
198 BlackboardAttribute longitude = attributeMap.get(BlackboardAttribute.ATTRIBUTE_TYPE.TSK_GEO_LONGITUDE_END);
199 BlackboardAttribute altitude = attributeMap.get(BlackboardAttribute.ATTRIBUTE_TYPE.TSK_GEO_ALTITUDE);
201 if (latitude != null && longitude != null) {
204 Bundle.Route_End_Label(),
206 latitude.getValueDouble(),
207 longitude.getValueDouble(),
208 altitude != null ? altitude.getValueDouble() : null,
List< Waypoint > getRoute()
Waypoint getRouteEndPoint(BlackboardArtifact artifact, Map< BlackboardAttribute.ATTRIBUTE_TYPE, BlackboardAttribute > attributeMap)
final List< Waypoint.Property > propertiesList
final BlackboardArtifact artifact
final List< Waypoint > getPath()
List< Waypoint.Property > getOtherProperties()
void createRoute(BlackboardArtifact artifact, Map< BlackboardAttribute.ATTRIBUTE_TYPE, BlackboardAttribute > attributeMap)
Waypoint getRouteStartPoint(BlackboardArtifact artifact, Map< BlackboardAttribute.ATTRIBUTE_TYPE, BlackboardAttribute > attributeMap)