private void updateLocalVersions() { if (NavigineApp.Navigation == null) return; for (int i = 0; i < mInfoList.size(); ++i) { LocationInfo info = mInfoList.get(i); String versionStr = LocationLoader.getLocalVersion(NavigineApp.AppContext, info.title); if (versionStr != null) { // Log.d(TAG, info.title + ": " + versionStr); info.localModified = versionStr.endsWith("+"); if (info.localModified) versionStr = versionStr.substring(0, versionStr.length() - 1); try { info.localVersion = Integer.parseInt(versionStr); } catch (Throwable e) { } } else { info.localVersion = -1; String mapFile = NavigineApp.Settings.getString("map_file", ""); if (mapFile.equals(info.archiveFile)) { NavigineApp.Navigation.loadArchive(null); SharedPreferences.Editor editor = NavigineApp.Settings.edit(); editor.putString("map_file", ""); editor.commit(); } } } mAdapter.updateList(); }
private void deleteLocation(LocationInfo info) { if (NavigineApp.Navigation == null) return; if (info != null) { try { (new File(info.archiveFile)).delete(); info.localVersion = -1; info.localModified = false; String locationDir = LocationLoader.getLocationDir(mContext, info.title); File dir = new File(locationDir); File[] files = dir.listFiles(); for (int i = 0; i < files.length; ++i) files[i].delete(); dir.delete(); String mapFile = NavigineApp.Settings.getString("map_file", ""); if (mapFile.equals(info.archiveFile)) { NavigineApp.Navigation.loadArchive(null); SharedPreferences.Editor editor = NavigineApp.Settings.edit(); editor.putString("map_file", ""); editor.commit(); } mAdapter.updateList(); } catch (Throwable e) { Log.e(TAG, Log.getStackTraceString(e)); } } }
void setSystemBundles(BundlesState state, LocationInfo info) { BundleInfo systemBundleInfo = state.getSystemBundle(); if (systemBundleInfo == null) { // TODO Log // throw new IllegalStateException("There is no systemBundle.\n"); return; } if (state.isFullySupported()) if (!this.checkResolve(systemBundleInfo, state)) { printoutUnsatisfiedConstraints(systemBundleInfo, state); return; } info.systemBundleLocation = systemBundleInfo.getLocation(); BundleInfo[] fragments = state.getSystemFragmentedBundles(); info.systemFragmentedBundleLocations = new URI[fragments.length]; for (int i = 0; i < fragments.length; i++) info.systemFragmentedBundleLocations[i] = fragments[i].getLocation(); }
public static void tdsp() { // node list used for store path ArrayList<Long> pathNodeList = new ArrayList<Long>(); // test start end node // OSMOutput.generateStartEndlNodeKML(START_NODE, END_NODE, nodeHashMap); // test count time long begintime = System.currentTimeMillis(); LocationInfo startLoc = new LocationInfo(OSMRouteParam.START_LAT, OSMRouteParam.START_LON); LocationInfo endLoc = new LocationInfo(OSMRouteParam.END_LAT, OSMRouteParam.END_LON); NodeInfo start = startLoc.searchNode(); NodeInfo end = endLoc.searchNode(); double cost; // routing using A* algorithm with priority queue // cost = routingAStar(start.getNodeId(), end.getNodeId(), OSMRouteParam.START_TIME, // OSMRouteParam.DAY_INDEX, pathNodeList); // routing using A* algorithm with fibonacci heap // cost = routingAStarFibonacci(start.getNodeId(), end.getNodeId(), OSMRouteParam.START_TIME, // OSMRouteParam.DAY_INDEX, pathNodeList); // routing using bidirectional hierarchy search cost = routingHierarchy( start.getNodeId(), end.getNodeId(), OSMRouteParam.START_TIME, OSMRouteParam.DAY_INDEX, pathNodeList); long endtime = System.currentTimeMillis(); long response = (endtime - begintime); System.out.println("routing cost: " + cost + " s, response time: " + response + " ms"); // output kml OSMOutput.generatePathKML(pathNodeList); // OSMOutput.generatePathNodeKML(pathNodeList); String turnByTurn = turnByTurn(pathNodeList); System.out.println(turnByTurn); }
void setPrerequisiteBundles( BundleInfo configuratorBundleInfo, BundlesState state, LocationInfo info) { if (state.isFullySupported()) if (!this.checkResolve(configuratorBundleInfo, state)) { printoutUnsatisfiedConstraints(configuratorBundleInfo, state); return; } BundleInfo[] prerequisites = state.getPrerequisteBundles(configuratorBundleInfo); info.prerequisiteLocations = new URI[prerequisites.length]; for (int i = 0; i < prerequisites.length; i++) info.prerequisiteLocations[i] = prerequisites[i].getLocation(); return; }