Autopsy  4.16.0
Graphical digital forensics platform for The Sleuth Kit and other tools.
GeoPath.java
Go to the documentation of this file.
1 /*
2  *
3  * Autopsy Forensic Browser
4  *
5  * Copyright 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.ArrayList;
23 import java.util.Collections;
24 import java.util.List;
25 import org.sleuthkit.datamodel.BlackboardArtifact;
26 import org.sleuthkit.datamodel.Content;
27 import org.sleuthkit.datamodel.SleuthkitCase;
28 import org.sleuthkit.datamodel.TskCoreException;
29 
33 public class GeoPath {
34  private final List<Waypoint> waypointList;
35  private final String pathName;
36  private final BlackboardArtifact artifact;
37 
48  static public List<Route> getRoutes(SleuthkitCase skCase) throws GeoLocationDataException {
49  List<BlackboardArtifact> artifacts = null;
50  try {
51  artifacts = skCase.getBlackboardArtifacts(BlackboardArtifact.ARTIFACT_TYPE.TSK_GPS_ROUTE);
52  } catch (TskCoreException ex) {
53  throw new GeoLocationDataException("Unable to get artifacts for type: TSK_GPS_BOOKMARK", ex);
54  }
55 
56  List<Route> routes = new ArrayList<>();
57  for (BlackboardArtifact artifact : artifacts) {
58  Route route = new Route(artifact);
59  routes.add(route);
60  }
61  return routes;
62  }
63 
76  public static GeoLocationParseResult<Track> getTracks(SleuthkitCase skCase, List<? extends Content> sourceList) throws GeoLocationDataException {
77  List<BlackboardArtifact> artifacts = null;
78  boolean allParsedSuccessfully = true;
79  List<Track> tracks = new ArrayList<>();
80  try {
81  artifacts = skCase.getBlackboardArtifacts(BlackboardArtifact.ARTIFACT_TYPE.TSK_GPS_TRACK);
82  for (BlackboardArtifact artifact : artifacts) {
83  if (sourceList == null || sourceList.contains(artifact.getDataSource())) {
84  try {
85  tracks.add(new Track(artifact));
86 
87  } catch (GeoLocationDataException e) {
88  allParsedSuccessfully = false;
89  }
90  }
91  }
92  } catch (TskCoreException ex) {
93  throw new GeoLocationDataException("Unable to get artifacts for type: TSK_GPS_BOOKMARK", ex);
94  }
95  return new GeoLocationParseResult<Track>(tracks, allParsedSuccessfully);
96  }
97 
104  GeoPath(BlackboardArtifact artifact, String pathName) {
105  this.waypointList = new ArrayList<>();
106  this.pathName = pathName;
107  this.artifact = artifact;
108  }
109 
115  final void addToPath(Waypoint point) {
116  waypointList.add(point);
117  }
118 
124  final public List<Waypoint> getPath() {
125  return Collections.unmodifiableList(waypointList);
126  }
127 
133  public final BlackboardArtifact getArtifact() {
134  return artifact;
135  }
136 
142  public String getLabel() {
143  return pathName != null ? pathName : "";
144  }
145 }
static List< Route > getRoutes(SleuthkitCase skCase)
Definition: GeoPath.java:48
static GeoLocationParseResult< Track > getTracks(SleuthkitCase skCase, List<?extends Content > sourceList)
Definition: GeoPath.java:76

Copyright © 2012-2020 Basis Technology. Generated on: Tue Sep 22 2020
This work is licensed under a Creative Commons Attribution-Share Alike 3.0 United States License.