6160 codacy

This commit is contained in:
Ethan Roseman 2020-04-17 12:11:26 -04:00
parent 94deee76d9
commit 6c10cd89e3
2 changed files with 36 additions and 37 deletions

View File

@ -50,7 +50,6 @@ import org.sleuthkit.autopsy.coreutils.MessageNotifyUtil;
import org.sleuthkit.autopsy.coreutils.ThreadConfined; import org.sleuthkit.autopsy.coreutils.ThreadConfined;
import org.sleuthkit.autopsy.geolocation.GeoFilterPanel.GeoFilter; import org.sleuthkit.autopsy.geolocation.GeoFilterPanel.GeoFilter;
import org.sleuthkit.autopsy.geolocation.datamodel.GeoLocationDataException; import org.sleuthkit.autopsy.geolocation.datamodel.GeoLocationDataException;
import org.sleuthkit.autopsy.geolocation.datamodel.Track;
import org.sleuthkit.autopsy.ingest.IngestManager; import org.sleuthkit.autopsy.ingest.IngestManager;
import static org.sleuthkit.autopsy.ingest.IngestManager.IngestModuleEvent.DATA_ADDED; import static org.sleuthkit.autopsy.ingest.IngestManager.IngestModuleEvent.DATA_ADDED;
import org.sleuthkit.autopsy.ingest.ModuleDataEvent; import org.sleuthkit.autopsy.ingest.ModuleDataEvent;

View File

@ -75,7 +75,6 @@ import javax.imageio.ImageIO;
import javax.swing.SwingUtilities; import javax.swing.SwingUtilities;
import org.jxmapviewer.painter.CompoundPainter; import org.jxmapviewer.painter.CompoundPainter;
import org.jxmapviewer.painter.Painter; import org.jxmapviewer.painter.Painter;
import org.sleuthkit.autopsy.geolocation.datamodel.Waypoint;
import org.sleuthkit.datamodel.BlackboardArtifact.ARTIFACT_TYPE; import org.sleuthkit.datamodel.BlackboardArtifact.ARTIFACT_TYPE;
/** /**
@ -325,6 +324,7 @@ final public class MapPanel extends javax.swing.JPanel {
/** /**
* Stores the given List of tracks from which to draw paths later * Stores the given List of tracks from which to draw paths later
*
* @param tracks * @param tracks
*/ */
void setTracks(List<Set<MapWaypoint>> tracks) { void setTracks(List<Set<MapWaypoint>> tracks) {
@ -730,14 +730,13 @@ final public class MapPanel extends javax.swing.JPanel {
/** /**
* *
* @param waypoint the waypoint for which to get the color * @param waypoint the waypoint for which to get the color selected
* selected
* @return the color that this waypoint should be rendered * @return the color that this waypoint should be rendered
*/ */
private Color getColor(MapWaypoint waypoint) { private Color getColor(MapWaypoint waypoint) {
Color baseColor = waypoint.getColor(); Color baseColor = waypoint.getColor();
if (waypoint.equals(currentlySelectedWaypoint) || if (waypoint.equals(currentlySelectedWaypoint)
(currentlySelectedTrack != null && currentlySelectedTrack.contains(waypoint))) { || (currentlySelectedTrack != null && currentlySelectedTrack.contains(waypoint))) {
// Highlight this waypoint since it is selected // Highlight this waypoint since it is selected
return Color.YELLOW; return Color.YELLOW;
} else { } else {
@ -800,9 +799,9 @@ final public class MapPanel extends javax.swing.JPanel {
int x = (int) point.getX(); int x = (int) point.getX();
int y = (int) point.getY(); int y = (int) point.getY();
if (artifactType == ARTIFACT_TYPE.TSK_GPS_TRACKPOINT.getTypeID() || if (artifactType == ARTIFACT_TYPE.TSK_GPS_TRACKPOINT.getTypeID()
artifactType == ARTIFACT_TYPE.TSK_GPS_TRACK.getTypeID() || || artifactType == ARTIFACT_TYPE.TSK_GPS_TRACK.getTypeID()
artifactType == ARTIFACT_TYPE.TSK_GPS_ROUTE.getTypeID()) { || artifactType == ARTIFACT_TYPE.TSK_GPS_ROUTE.getTypeID()) {
image = dotImageCache.computeIfAbsent(color, k -> { image = dotImageCache.computeIfAbsent(color, k -> {
return createTrackDotImage(color); return createTrackDotImage(color);
}); });
@ -818,9 +817,9 @@ final public class MapPanel extends javax.swing.JPanel {
// Center image horizontally on image // Center image horizontally on image
x -= image.getWidth() / 2; x -= image.getWidth() / 2;
g = (Graphics2D) g.create(); Graphics2D g2d = (Graphics2D) g.create();
g.drawImage(image, x, y, null); g2d.drawImage(image, x, y, null);
g.dispose(); g2d.dispose();
} }
} }
@ -828,6 +827,7 @@ final public class MapPanel extends javax.swing.JPanel {
* Renderer for map track routes * Renderer for map track routes
*/ */
private class MapTrackRenderer implements Painter<JXMapViewer> { private class MapTrackRenderer implements Painter<JXMapViewer> {
private final List<Set<MapWaypoint>> tracks; private final List<Set<MapWaypoint>> tracks;
MapTrackRenderer(List<Set<MapWaypoint>> tracks) { MapTrackRenderer(List<Set<MapWaypoint>> tracks) {
@ -858,21 +858,21 @@ final public class MapPanel extends javax.swing.JPanel {
@Override @Override
public void paint(Graphics2D g, JXMapViewer map, int w, int h) { public void paint(Graphics2D g, JXMapViewer map, int w, int h) {
g = (Graphics2D) g.create(); Graphics2D g2d = (Graphics2D) g.create();
Rectangle bounds = map.getViewportBounds(); Rectangle bounds = map.getViewportBounds();
g.translate(-bounds.x, -bounds.y); g2d.translate(-bounds.x, -bounds.y);
g.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
g.setColor(Color.BLACK); g2d.setColor(Color.BLACK);
g.setStroke(new BasicStroke(2)); g2d.setStroke(new BasicStroke(2));
for (Set<MapWaypoint> track : tracks) { for (Set<MapWaypoint> track : tracks) {
drawRoute(track, g, map); drawRoute(track, g2d, map);
} }
g.dispose(); g2d.dispose();
} }
} }
} }