/** * 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; }
/** * Resets the simulation to desiredIndex * * @param desiredIndex */ private void resetToIndex(int desiredIndex) { if (desiredIndex <= trackLDMIO.getAllGpsPoints().size()) { if (desiredIndex <= dbgPosIndex) { System.err.println("Visited"); initDebugRun(); } nDebugSteps(desiredIndex - dbgPosIndex); } }
@Override public Void call() throws Exception { long nexttime = (trackLDMIO.getAllGpsPoints().size() == 0) ? 1000 : trackLDMIO.getLastGpsPoint().time + 1000; GpsPoint newpoint = new GpsPoint( globeDisplayAdapter.lastPos.getLongitude().degrees, globeDisplayAdapter.lastPos.getLatitude().degrees, nexttime); addGpsPoint(newpoint); return null; }
/** * Loads .track file from newTrackFile to trackLDMIO, inits debug run, zooms to newest GpsPoint * * @param newTrackFile URI to track file * @return if loading the trackfile was successful */ private boolean loadNewData(String newTrackFile) { LDMIOTrack tmpTrackLDMIO; try { tmpTrackLDMIO = new LDMIOTrack(newTrackFile); } catch (IOException e) { return false; } save(); trackLDMIO = tmpTrackLDMIO; enableSettingsMode(true); initDebugRun(); if (trackLDMIO.getAllGpsPoints().size() > 0) { View view = globeMapPanel.wwd.getView(); view.goTo(new Position(translateToGlobePosition(trackLDMIO.getLastGpsPoint()), 0), 4000); } slider.setMaximum( (trackLDMIO.getAllGpsPoints() == null) ? 0 : trackLDMIO.getAllGpsPoints().size()); setTitle("testloc.world + " + newTrackFile); return true; }