/** * Inserts the dbgPosIndex's value in trackLDMIO into locDataManager, changes slider, * globeDisplayAdapter and increments dbgPosIndex * * @return if the current step was the last currently available */ private boolean debugStep() { if (dbgPosIndex == trackLDMIO.getAllGpsPoints().size()) return true; GpsPoint newp = trackLDMIO.getAllGpsPoints().get(dbgPosIndex); locDataManager.addPoint(newp); slider.setValue(dbgPosIndex); globeDisplayAdapter.addPosition(translateToGlobePosition(newp)); try { Marker newm = trackLDMIO.getAllMarkers().get(dbgMarkerIndex); if (newm.time <= newp.time) { try { Marker newmarker = locDataManager.addMarker(newm.imgpoint, newm.time); globeDisplayAdapter.addMarker(translateToGlobePosition(newmarker.realpoint)); mapDisplayAdapter.addMarker(translateToImagePosition(newmarker.imgpoint)); dbgMarkerIndex++; } catch (NoGpsDataAvailableException | PointNotInImageBoundsException e) { e.printStackTrace(); } } } catch (IndexOutOfBoundsException e) { System.err.println("debugStep called but last marker was already read"); } dbgPosIndex++; return false; }
@Override public Void call() throws Exception { Point2D p = locDataManager.getLastImagePoint(); if (p != null) mapDisplayAdapter.addPosition(translateToImagePosition(p)); return null; }
/** Resets the simulation to the beginning Prints CSV's of loaded position data */ private void initDebugRun() { dbgPosIndex = 0; dbgMarkerIndex = 0; slider.setValue(0); globeDisplayAdapter.clear(); mapDisplayAdapter.clear(); Point2D imageSize = new Point2D(mapBufferedImage.getWidth(), mapBufferedImage.getHeight()); locDataManager = new LocationDataManager( positionUpdateHandler, new LDMIOEmpty(), imageSize, new TriangleImagePositionLocator( imageSize, new IPLSettingsContainer( Double.parseDouble(textFieldTriDissimilarity.getText()), Double.parseDouble(textFieldDistFallofExp.getText()), Double.parseDouble(textFieldBadTriPen.getText()), Double.parseDouble(textFieldMinTriAngle.getText()), true))); locDataManager.setSpeedFiltering(false); trackLDMIO.printValuesAsCSV(System.out); }