1 /*
2 *
3 * Autopsy Forensic Browser
4 *
5 * Copyright 2019-2020 Basis Technology Corp.
6 * contact: carrier <at> sleuthkit <dot> org
7 *
8 * Licensed under the Apache License, Version 2.0 (the "License");
9 * you may not use this file except in compliance with the License.
10 * You may obtain a copy of the License at
11 *
12 * http://www.apache.org/licenses/LICENSE-2.0
13 *
14 * Unless required by applicable law or agreed to in writing, software
15 * distributed under the License is distributed on an "AS IS" BASIS,
16 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17 * See the License for the specific language governing permissions and
18 * limitations under the License.
19 */
20 package org.sleuthkit.autopsy.geolocation.datamodel;
21
22 import java.util.Collections;
23 import java.util.List;
24 import java.util.Map;
25 import org.openide.util.NbBundle.Messages;
28 import org.
sleuthkit.datamodel.blackboardutils.attributes.BlackboardJsonAttrUtil;
29 import org.
sleuthkit.datamodel.blackboardutils.attributes.BlackboardJsonAttrUtil.InvalidJsonException;
30 import org.
sleuthkit.datamodel.blackboardutils.attributes.GeoWaypoints;
31
39
41
42 // This list is not expected to change after construction so the
43 // constructor will take care of creating an unmodifiable List
45
51 @Messages({
52 // This is the original static hardcoded label from the
53 // original kml-report code
54 "Route_Label=As-the-crow-flies Route"
55 })
57 super(
artifact, Bundle.Route_Label());
58
59 Map<BlackboardAttribute.ATTRIBUTE_TYPE, BlackboardAttribute> attributeMap =
Waypoint.getAttributesFromArtifactAsMap(
artifact);
60
62
63 BlackboardAttribute attribute = attributeMap.get(BlackboardAttribute.ATTRIBUTE_TYPE.TSK_DATETIME);
64 timestamp = attribute != null ? attribute.getValueLong() : null;
65
67 }
68
76 }
77
86 }
87
95 }
96
106 @Messages({
107 "Route_point_label=Waypoints for route"
108 })
110 BlackboardAttribute attribute = attributeMap.get(BlackboardAttribute.ATTRIBUTE_TYPE.TSK_GEO_WAYPOINTS);
111
113 if (label == null || label.isEmpty()) {
114 label = Bundle.Route_point_label();
115 } else {
116 label = String.format("%s: %s", Bundle.Route_point_label(), label);
117 }
118
119 if (attribute != null) {
120 GeoWaypoints waypoints;
121 try {
122 waypoints = BlackboardJsonAttrUtil.fromAttribute(attribute, GeoWaypoints.class);
123 } catch (InvalidJsonException ex) {
124 throw new GeoLocationDataException(String.format(
"Unable to parse waypoints in TSK_GEO_WAYPOINTS attribute (artifact object ID =%d)", artifact.getId()), ex);
125 }
126 for (GeoWaypoints.Waypoint waypoint : waypoints) {
127 addToPath(
new Waypoint(artifact, label, null, waypoint.getLatitude(), waypoint.getLongitude(), waypoint.getAltitude(), null, attributeMap,
this));
128 }
129 } else {
132
133 addToPath(start);
134 addToPath(end);
135 }
136 }
137
150 @Messages({
151 "Route_Start_Label=Start"
152 })
153
155 BlackboardAttribute latitude = attributeMap.get(BlackboardAttribute.ATTRIBUTE_TYPE.TSK_GEO_LATITUDE_START);
156 BlackboardAttribute longitude = attributeMap.get(BlackboardAttribute.ATTRIBUTE_TYPE.TSK_GEO_LONGITUDE_START);
157 BlackboardAttribute altitude = attributeMap.get(BlackboardAttribute.ATTRIBUTE_TYPE.TSK_GEO_ALTITUDE);
158
159 if (latitude != null && longitude != null) {
161 Bundle.Route_Start_Label(),
162 latitude.getValueDouble(),
163 longitude.getValueDouble(),
164 altitude != null ? altitude.getValueDouble() : null,
165 attributeMap);
166 } else {
168 }
169 }
170
183 @Messages({
184 "Route_End_Label=End"
185 })
187 BlackboardAttribute latitude = attributeMap.get(BlackboardAttribute.ATTRIBUTE_TYPE.TSK_GEO_LATITUDE_END);
188 BlackboardAttribute longitude = attributeMap.get(BlackboardAttribute.ATTRIBUTE_TYPE.TSK_GEO_LONGITUDE_END);
189 BlackboardAttribute altitude = attributeMap.get(BlackboardAttribute.ATTRIBUTE_TYPE.TSK_GEO_ALTITUDE);
190
191 if (latitude != null && longitude != null) {
192
194 Bundle.Route_End_Label(),
195 latitude.getValueDouble(),
196 longitude.getValueDouble(),
197 altitude != null ? altitude.getValueDouble() : null,
198 attributeMap);
199 } else {
201 }
202 }
203
208
222 super(artifact,
223 label,
224 null,
225 latitude,
226 longitude,
227 altitude,
228 null,
229 attributeMap,
231 }
232
233 @Override
236 }
237 }
238 }
GeoPath getParentGeoPath()
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)