mirror of
https://github.com/overcuriousity/autopsy-flatpak.git
synced 2025-07-17 18:17:43 +00:00
6160 codacy
This commit is contained in:
parent
94deee76d9
commit
6c10cd89e3
@ -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;
|
||||||
|
@ -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;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -214,7 +213,7 @@ final public class MapPanel extends javax.swing.JPanel {
|
|||||||
|
|
||||||
initializePainter();
|
initializePainter();
|
||||||
}
|
}
|
||||||
|
|
||||||
void initializePainter() {
|
void initializePainter() {
|
||||||
// Basic painters for the way points.
|
// Basic painters for the way points.
|
||||||
WaypointPainter<MapWaypoint> waypointPainter = new WaypointPainter<MapWaypoint>() {
|
WaypointPainter<MapWaypoint> waypointPainter = new WaypointPainter<MapWaypoint>() {
|
||||||
@ -228,11 +227,11 @@ final public class MapPanel extends javax.swing.JPanel {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
waypointPainter.setRenderer(new MapWaypointRenderer());
|
waypointPainter.setRenderer(new MapWaypointRenderer());
|
||||||
|
|
||||||
ArrayList<Painter<JXMapViewer>> painters = new ArrayList<>();
|
ArrayList<Painter<JXMapViewer>> painters = new ArrayList<>();
|
||||||
painters.add(new MapTrackRenderer(tracks));
|
painters.add(new MapTrackRenderer(tracks));
|
||||||
painters.add(waypointPainter);
|
painters.add(waypointPainter);
|
||||||
|
|
||||||
CompoundPainter<JXMapViewer> compoundPainter = new CompoundPainter<>(painters);
|
CompoundPainter<JXMapViewer> compoundPainter = new CompoundPainter<>(painters);
|
||||||
mapViewer.setOverlayPainter(compoundPainter);
|
mapViewer.setOverlayPainter(compoundPainter);
|
||||||
}
|
}
|
||||||
@ -322,10 +321,11 @@ final public class MapPanel extends javax.swing.JPanel {
|
|||||||
}
|
}
|
||||||
mapViewer.repaint();
|
mapViewer.repaint();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 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) {
|
||||||
this.tracks = tracks;
|
this.tracks = 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,61 +817,62 @@ 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();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 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) {
|
||||||
this.tracks = tracks;
|
this.tracks = tracks;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void drawRoute(Set<MapWaypoint> track, Graphics2D g, JXMapViewer map) {
|
private void drawRoute(Set<MapWaypoint> track, Graphics2D g, JXMapViewer map) {
|
||||||
int lastX = 0;
|
int lastX = 0;
|
||||||
int lastY = 0;
|
int lastY = 0;
|
||||||
|
|
||||||
boolean first = true;
|
boolean first = true;
|
||||||
|
|
||||||
for (MapWaypoint wp : track) {
|
for (MapWaypoint wp : track) {
|
||||||
Point2D p = map.getTileFactory().geoToPixel(wp.getPosition(), map.getZoom());
|
Point2D p = map.getTileFactory().geoToPixel(wp.getPosition(), map.getZoom());
|
||||||
int thisX = (int) p.getX();
|
int thisX = (int) p.getX();
|
||||||
int thisY = (int) p.getY();
|
int thisY = (int) p.getY();
|
||||||
|
|
||||||
if (first) {
|
if (first) {
|
||||||
first = false;
|
first = false;
|
||||||
} else {
|
} else {
|
||||||
g.drawLine(lastX, lastY, thisX, thisY);
|
g.drawLine(lastX, lastY, thisX, thisY);
|
||||||
}
|
}
|
||||||
|
|
||||||
lastX = thisX;
|
lastX = thisX;
|
||||||
lastY = thisY;
|
lastY = thisY;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@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();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user