extended configuration (to hande Kitkat issues)
This commit is contained in:
parent
a6878ba04e
commit
631057cd5f
10 changed files with 251 additions and 40 deletions
58
brouter-core/src/main/java/btools/router/RoutingHelper.java
Normal file
58
brouter-core/src/main/java/btools/router/RoutingHelper.java
Normal file
|
@ -0,0 +1,58 @@
|
||||||
|
/**
|
||||||
|
* static helper class for handling datafiles
|
||||||
|
*
|
||||||
|
* @author ab
|
||||||
|
*/
|
||||||
|
package btools.router;
|
||||||
|
|
||||||
|
import java.io.File;
|
||||||
|
|
||||||
|
import btools.mapaccess.StorageConfigHelper;
|
||||||
|
|
||||||
|
public final class RoutingHelper
|
||||||
|
{
|
||||||
|
public static File getAdditionalMaptoolDir( String segmentDir )
|
||||||
|
{
|
||||||
|
return StorageConfigHelper.getAdditionalMaptoolDir(segmentDir);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static File getSecondarySegmentDir( String segmentDir )
|
||||||
|
{
|
||||||
|
return StorageConfigHelper.getSecondarySegmentDir(segmentDir);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public static boolean hasDirectoryAnyDatafiles( String segmentDir )
|
||||||
|
{
|
||||||
|
if ( hasAnyDatafiles( new File( segmentDir ) ) )
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
// check secondary, too
|
||||||
|
File secondary = StorageConfigHelper.getSecondarySegmentDir( segmentDir );
|
||||||
|
if ( secondary != null )
|
||||||
|
{
|
||||||
|
return hasAnyDatafiles( secondary );
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static boolean hasAnyDatafiles( File dir )
|
||||||
|
{
|
||||||
|
String[] fileNames = dir.list();
|
||||||
|
for( String fileName : fileNames )
|
||||||
|
{
|
||||||
|
if ( fileName.endsWith( ".rd5" ) ) return true;
|
||||||
|
}
|
||||||
|
File carSubset = new File( dir, "carsubset" );
|
||||||
|
if ( carSubset.isDirectory() )
|
||||||
|
{
|
||||||
|
fileNames = carSubset.list();
|
||||||
|
for( String fileName : fileNames )
|
||||||
|
{
|
||||||
|
if ( fileName.endsWith( ".cd5" ) ) return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
|
@ -5,12 +5,8 @@
|
||||||
*/
|
*/
|
||||||
package btools.mapcreator;
|
package btools.mapcreator;
|
||||||
|
|
||||||
import java.io.ByteArrayOutputStream;
|
|
||||||
import java.io.DataOutputStream;
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
|
||||||
import sun.security.pkcs.SigningCertificateInfo;
|
|
||||||
|
|
||||||
import btools.util.ByteDataWriter;
|
import btools.util.ByteDataWriter;
|
||||||
|
|
||||||
public class OsmNodeP implements Comparable<OsmNodeP>
|
public class OsmNodeP implements Comparable<OsmNodeP>
|
||||||
|
|
|
@ -13,7 +13,9 @@ import java.util.List;
|
||||||
|
|
||||||
public final class NodesCache
|
public final class NodesCache
|
||||||
{
|
{
|
||||||
private String segmentDir;
|
private File segmentDir;
|
||||||
|
private File secondarySegmentsDir = null;
|
||||||
|
|
||||||
private OsmNodesMap nodesMap;
|
private OsmNodesMap nodesMap;
|
||||||
private int lookupVersion;
|
private int lookupVersion;
|
||||||
private int lookupMinorVersion;
|
private int lookupMinorVersion;
|
||||||
|
@ -33,21 +35,25 @@ public final class NodesCache
|
||||||
|
|
||||||
private long cacheSum = 0;
|
private long cacheSum = 0;
|
||||||
private boolean garbageCollectionEnabled = false;
|
private boolean garbageCollectionEnabled = false;
|
||||||
|
|
||||||
|
|
||||||
public NodesCache( String segmentDir, OsmNodesMap nodesMap, int lookupVersion, int minorVersion, boolean varLen, boolean carMode, NodesCache oldCache )
|
public NodesCache( String segmentDir, OsmNodesMap nodesMap, int lookupVersion, int minorVersion, boolean varLen, boolean carMode, NodesCache oldCache )
|
||||||
{
|
{
|
||||||
this.segmentDir = segmentDir;
|
this.segmentDir = new File( segmentDir );
|
||||||
this.nodesMap = nodesMap;
|
this.nodesMap = nodesMap;
|
||||||
this.lookupVersion = lookupVersion;
|
this.lookupVersion = lookupVersion;
|
||||||
this.lookupMinorVersion = minorVersion;
|
this.lookupMinorVersion = minorVersion;
|
||||||
this.readVarLength = varLen;
|
this.readVarLength = varLen;
|
||||||
this.carMode = carMode;
|
this.carMode = carMode;
|
||||||
|
|
||||||
|
if ( !this.segmentDir.isDirectory() ) throw new RuntimeException( "segment directory " + segmentDir + " does not exist" );
|
||||||
|
|
||||||
if ( oldCache != null )
|
if ( oldCache != null )
|
||||||
{
|
{
|
||||||
fileCache = oldCache.fileCache;
|
fileCache = oldCache.fileCache;
|
||||||
iobuffer = oldCache.iobuffer;
|
iobuffer = oldCache.iobuffer;
|
||||||
oom_carsubset_hint = oldCache.oom_carsubset_hint;
|
oom_carsubset_hint = oldCache.oom_carsubset_hint;
|
||||||
|
secondarySegmentsDir = oldCache.secondarySegmentsDir;
|
||||||
|
|
||||||
// re-use old, virgin caches
|
// re-use old, virgin caches
|
||||||
fileRows = oldCache.fileRows;
|
fileRows = oldCache.fileRows;
|
||||||
|
@ -65,8 +71,20 @@ public final class NodesCache
|
||||||
fileCache = new HashMap<String,PhysicalFile>(4);
|
fileCache = new HashMap<String,PhysicalFile>(4);
|
||||||
fileRows = new OsmFile[180][];
|
fileRows = new OsmFile[180][];
|
||||||
iobuffer = new byte[65636];
|
iobuffer = new byte[65636];
|
||||||
|
secondarySegmentsDir = StorageConfigHelper.getSecondarySegmentDir( segmentDir );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private File getFileFromSegmentDir( String filename )
|
||||||
|
{
|
||||||
|
File f = new File( segmentDir, filename );
|
||||||
|
if ( secondarySegmentsDir != null && !f.exists() )
|
||||||
|
{
|
||||||
|
File f2 = new File( secondarySegmentsDir, filename );
|
||||||
|
if ( f2.exists() ) return f2;
|
||||||
|
}
|
||||||
|
return f;
|
||||||
|
}
|
||||||
|
|
||||||
// if the cache sum exceeded a threshold,
|
// if the cache sum exceeded a threshold,
|
||||||
// clean all ghosts and enable garbage collection
|
// clean all ghosts and enable garbage collection
|
||||||
|
@ -185,9 +203,6 @@ public final class NodesCache
|
||||||
|
|
||||||
private OsmFile fileForSegment( int lonDegree, int latDegree ) throws Exception
|
private OsmFile fileForSegment( int lonDegree, int latDegree ) throws Exception
|
||||||
{
|
{
|
||||||
File base = new File( segmentDir );
|
|
||||||
if ( !base.isDirectory() ) throw new RuntimeException( "segment directory " + segmentDir + " does not exist" );
|
|
||||||
|
|
||||||
int lonMod5 = lonDegree % 5;
|
int lonMod5 = lonDegree % 5;
|
||||||
int latMod5 = latDegree % 5;
|
int latMod5 = latDegree % 5;
|
||||||
int tileIndex = lonMod5 * 5 + latMod5;
|
int tileIndex = lonMod5 * 5 + latMod5;
|
||||||
|
@ -207,12 +222,12 @@ public final class NodesCache
|
||||||
File f = null;
|
File f = null;
|
||||||
if ( carMode )
|
if ( carMode )
|
||||||
{
|
{
|
||||||
File carFile = new File( new File( base, "carsubset" ), filenameBase + ".cd5" );
|
File carFile = getFileFromSegmentDir( "carsubset/" + filenameBase + ".cd5" );
|
||||||
if ( carFile.exists() ) f = carFile;
|
if ( carFile.exists() ) f = carFile;
|
||||||
}
|
}
|
||||||
if ( f == null )
|
if ( f == null )
|
||||||
{
|
{
|
||||||
File fullFile = new File( base, filenameBase + ".rd5" );
|
File fullFile = getFileFromSegmentDir( filenameBase + ".rd5" );
|
||||||
if ( fullFile.exists() ) f = fullFile;
|
if ( fullFile.exists() ) f = fullFile;
|
||||||
if ( carMode && f != null ) oom_carsubset_hint = true;
|
if ( carMode && f != null ) oom_carsubset_hint = true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,55 @@
|
||||||
|
/**
|
||||||
|
* Access to the storageconfig.txt config file
|
||||||
|
*
|
||||||
|
* @author ab
|
||||||
|
*/
|
||||||
|
package btools.mapaccess;
|
||||||
|
|
||||||
|
import java.io.BufferedReader;
|
||||||
|
import java.io.File;
|
||||||
|
import java.io.FileReader;
|
||||||
|
|
||||||
|
public class StorageConfigHelper
|
||||||
|
{
|
||||||
|
public static File getSecondarySegmentDir( String segmentDir )
|
||||||
|
{
|
||||||
|
return getStorageLocation( segmentDir, "secondary_segment_dir=" );
|
||||||
|
}
|
||||||
|
|
||||||
|
public static File getAdditionalMaptoolDir( String segmentDir )
|
||||||
|
{
|
||||||
|
return getStorageLocation( segmentDir, "additional_maptool_dir=" );
|
||||||
|
}
|
||||||
|
|
||||||
|
private static File getStorageLocation( String segmentDir, String tag )
|
||||||
|
{
|
||||||
|
File res = null;
|
||||||
|
BufferedReader br = null;
|
||||||
|
String configFile = segmentDir + "/storageconfig.txt";
|
||||||
|
try
|
||||||
|
{
|
||||||
|
br = new BufferedReader( new FileReader (configFile ) );
|
||||||
|
for(;;)
|
||||||
|
{
|
||||||
|
String line = br.readLine();
|
||||||
|
if ( line == null ) break;
|
||||||
|
line = line.trim();
|
||||||
|
if ( line.startsWith( "#") ) continue;
|
||||||
|
if ( line.startsWith( tag ) )
|
||||||
|
{
|
||||||
|
String path = line.substring( tag.length() ).trim();
|
||||||
|
res = path.startsWith( "/" ) ? new File( path ) : new File( new File( segmentDir ) , path );
|
||||||
|
if ( !res.exists() ) res = null;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch( Exception e ) {}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
if ( br != null ) try { br.close(); } catch( Exception ee ) {}
|
||||||
|
}
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
BIN
brouter-routing-app/assets/segments3.zip
Normal file
BIN
brouter-routing-app/assets/segments3.zip
Normal file
Binary file not shown.
|
@ -0,0 +1,68 @@
|
||||||
|
package btools.routingapp;
|
||||||
|
|
||||||
|
import java.io.File;
|
||||||
|
import java.io.FileWriter;
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
|
import android.os.Environment;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* static logger interface to be used in the android app
|
||||||
|
*/
|
||||||
|
public class AppLogger
|
||||||
|
{
|
||||||
|
private static FileWriter debugLogWriter = null;
|
||||||
|
private static boolean initDone = false;
|
||||||
|
|
||||||
|
private static void init()
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
// open logfile if existing
|
||||||
|
File sd = Environment.getExternalStorageDirectory();
|
||||||
|
if ( sd == null ) return;
|
||||||
|
File debugLog = new File( sd, "brouterapp.txt" );
|
||||||
|
if ( debugLog.exists() )
|
||||||
|
{
|
||||||
|
debugLogWriter = new FileWriter( debugLog, true );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch( IOException ioe ) {}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* log an info trace to the app log file, if any
|
||||||
|
*/
|
||||||
|
public static boolean isLogging()
|
||||||
|
{
|
||||||
|
if ( !initDone )
|
||||||
|
{
|
||||||
|
initDone = true;
|
||||||
|
init();
|
||||||
|
log( "logging started at " + new Date() );
|
||||||
|
}
|
||||||
|
return debugLogWriter != null;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* log an info trace to the app log file, if any
|
||||||
|
*/
|
||||||
|
public static void log( String msg )
|
||||||
|
{
|
||||||
|
if ( isLogging() )
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
debugLogWriter.write( msg );
|
||||||
|
debugLogWriter.write( '\n' );
|
||||||
|
debugLogWriter.flush();
|
||||||
|
}
|
||||||
|
catch( IOException e )
|
||||||
|
{
|
||||||
|
throw new RuntimeException( "cannot write appdebug.txt: " + e );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -25,6 +25,7 @@ import android.view.MotionEvent;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.widget.Toast;
|
import android.widget.Toast;
|
||||||
import btools.mapaccess.PhysicalFile;
|
import btools.mapaccess.PhysicalFile;
|
||||||
|
import btools.router.RoutingHelper;
|
||||||
|
|
||||||
public class BInstallerView extends View
|
public class BInstallerView extends View
|
||||||
{
|
{
|
||||||
|
@ -209,8 +210,15 @@ public class BInstallerView extends View
|
||||||
{
|
{
|
||||||
clearTileSelection( MASK_INSTALLED_CD5 | MASK_INSTALLED_RD5 );
|
clearTileSelection( MASK_INSTALLED_CD5 | MASK_INSTALLED_RD5 );
|
||||||
|
|
||||||
scanExistingFiles( new File( baseDir + "/brouter/segments2" ), ".rd5", MASK_INSTALLED_RD5 );
|
scanExistingFiles( new File( baseDir + "/brouter/segments3" ), ".rd5", MASK_INSTALLED_RD5 );
|
||||||
scanExistingFiles( new File( baseDir + "/brouter/segments2/carsubset" ), ".cd5", MASK_INSTALLED_CD5 );
|
scanExistingFiles( new File( baseDir + "/brouter/segments3/carsubset" ), ".cd5", MASK_INSTALLED_CD5 );
|
||||||
|
|
||||||
|
File secondary = RoutingHelper.getSecondarySegmentDir( baseDir + "/brouter/segments3" );
|
||||||
|
if ( secondary != null )
|
||||||
|
{
|
||||||
|
scanExistingFiles( secondary, ".rd5", MASK_INSTALLED_RD5 );
|
||||||
|
scanExistingFiles( new File( secondary, "carsubset" ), ".cd5", MASK_INSTALLED_CD5 );
|
||||||
|
}
|
||||||
|
|
||||||
StatFs stat = new StatFs(baseDir);
|
StatFs stat = new StatFs(baseDir);
|
||||||
availableSize = (long)stat.getAvailableBlocks()*stat.getBlockSize();
|
availableSize = (long)stat.getAvailableBlocks()*stat.getBlockSize();
|
||||||
|
@ -599,7 +607,7 @@ float tx, ty;
|
||||||
input = connection.getInputStream();
|
input = connection.getInputStream();
|
||||||
|
|
||||||
int slidx = surl.lastIndexOf( "segments3/" );
|
int slidx = surl.lastIndexOf( "segments3/" );
|
||||||
fname = baseDir + "/brouter/segments2/" + surl.substring( slidx+10 );
|
fname = baseDir + "/brouter/segments3/" + surl.substring( slidx+10 );
|
||||||
tmp_file = new File( fname + "_tmp" );
|
tmp_file = new File( fname + "_tmp" );
|
||||||
if ( new File( fname ).exists() ) return "internal error: file exists: " + fname;
|
if ( new File( fname ).exists() ) return "internal error: file exists: " + fname;
|
||||||
output = new FileOutputStream( tmp_file );
|
output = new FileOutputStream( tmp_file );
|
||||||
|
|
|
@ -57,7 +57,7 @@ public class BRouterService extends Service
|
||||||
{
|
{
|
||||||
String modesFile = baseDir + "/brouter/modes/serviceconfig.dat";
|
String modesFile = baseDir + "/brouter/modes/serviceconfig.dat";
|
||||||
br = new BufferedReader( new FileReader (modesFile ) );
|
br = new BufferedReader( new FileReader (modesFile ) );
|
||||||
worker.segmentDir = baseDir + "/brouter/segments2";
|
worker.segmentDir = baseDir + "/brouter/segments3";
|
||||||
for(;;)
|
for(;;)
|
||||||
{
|
{
|
||||||
String line = br.readLine();
|
String line = br.readLine();
|
||||||
|
@ -67,7 +67,7 @@ public class BRouterService extends Service
|
||||||
worker.profilePath = baseDir + "/brouter/profiles2/" + smc.profile + ".brf";
|
worker.profilePath = baseDir + "/brouter/profiles2/" + smc.profile + ".brf";
|
||||||
worker.rawTrackPath = baseDir + "/brouter/modes/" + mode_key + "_rawtrack.dat";
|
worker.rawTrackPath = baseDir + "/brouter/modes/" + mode_key + "_rawtrack.dat";
|
||||||
|
|
||||||
CoordinateReader cor = CoordinateReader.obtainValidReader( baseDir );
|
CoordinateReader cor = CoordinateReader.obtainValidReader( baseDir, worker.segmentDir );
|
||||||
worker.nogoList = new ArrayList<OsmNodeNamed>();
|
worker.nogoList = new ArrayList<OsmNodeNamed>();
|
||||||
// veto nogos by profiles veto list
|
// veto nogos by profiles veto list
|
||||||
for(OsmNodeNamed nogo : cor.nogopoints )
|
for(OsmNodeNamed nogo : cor.nogopoints )
|
||||||
|
|
|
@ -11,6 +11,7 @@ import java.io.IOException;
|
||||||
import java.io.InputStream;
|
import java.io.InputStream;
|
||||||
import java.io.InputStreamReader;
|
import java.io.InputStreamReader;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
import java.util.Date;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
@ -36,6 +37,7 @@ import btools.router.OsmNodeNamed;
|
||||||
import btools.router.OsmTrack;
|
import btools.router.OsmTrack;
|
||||||
import btools.router.RoutingContext;
|
import btools.router.RoutingContext;
|
||||||
import btools.router.RoutingEngine;
|
import btools.router.RoutingEngine;
|
||||||
|
import btools.router.RoutingHelper;
|
||||||
|
|
||||||
public class BRouterView extends View
|
public class BRouterView extends View
|
||||||
{
|
{
|
||||||
|
@ -71,6 +73,7 @@ public class BRouterView extends View
|
||||||
|
|
||||||
private int[] imgPixels;
|
private int[] imgPixels;
|
||||||
|
|
||||||
|
|
||||||
public void startSimulation() {
|
public void startSimulation() {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -138,18 +141,19 @@ public class BRouterView extends View
|
||||||
ConfigHelper.writeBaseDir( getContext(), baseDir );
|
ConfigHelper.writeBaseDir( getContext(), baseDir );
|
||||||
}
|
}
|
||||||
String basedir = fbd.getAbsolutePath();
|
String basedir = fbd.getAbsolutePath();
|
||||||
|
AppLogger.log( "using basedir: " + basedir );
|
||||||
|
|
||||||
// create missing directories
|
// create missing directories
|
||||||
assertDirectoryExists( "project directory", basedir + "/brouter", null );
|
assertDirectoryExists( "project directory", basedir + "/brouter", null );
|
||||||
segmentDir = basedir + "/brouter/segments2";
|
segmentDir = basedir + "/brouter/segments3";
|
||||||
assertDirectoryExists( "data directory", segmentDir, null );
|
assertDirectoryExists( "data directory", segmentDir, "segments3.zip" );
|
||||||
assertDirectoryExists( "carsubset directory", segmentDir + "/carsubset", null );
|
assertDirectoryExists( "carsubset directory", segmentDir + "/carsubset", null );
|
||||||
profileDir = basedir + "/brouter/profiles2";
|
profileDir = basedir + "/brouter/profiles2";
|
||||||
assertDirectoryExists( "profile directory", profileDir, "profiles2.zip" );
|
assertDirectoryExists( "profile directory", profileDir, "profiles2.zip" );
|
||||||
modesDir = basedir + "/brouter/modes";
|
modesDir = basedir + "/brouter/modes";
|
||||||
assertDirectoryExists( "modes directory", modesDir, "modes.zip" );
|
assertDirectoryExists( "modes directory", modesDir, "modes.zip" );
|
||||||
|
|
||||||
cor = CoordinateReader.obtainValidReader( basedir );
|
cor = CoordinateReader.obtainValidReader( basedir, segmentDir );
|
||||||
wpList = cor.waypoints;
|
wpList = cor.waypoints;
|
||||||
nogoList = cor.nogopoints;
|
nogoList = cor.nogopoints;
|
||||||
nogoVetoList = new ArrayList<OsmNodeNamed>();
|
nogoVetoList = new ArrayList<OsmNodeNamed>();
|
||||||
|
@ -176,23 +180,7 @@ public class BRouterView extends View
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
boolean segmentFound = false;
|
String[] fileNames = new File( profileDir ).list();
|
||||||
String[] fileNames = new File( segmentDir ).list();
|
|
||||||
for( String fileName : fileNames )
|
|
||||||
{
|
|
||||||
if ( fileName.endsWith( ".rd5" ) ) segmentFound = true;
|
|
||||||
}
|
|
||||||
File carSubset = new File( segmentDir, "carsubset" );
|
|
||||||
if ( carSubset.isDirectory() )
|
|
||||||
{
|
|
||||||
fileNames = carSubset.list();
|
|
||||||
for( String fileName : fileNames )
|
|
||||||
{
|
|
||||||
if ( fileName.endsWith( ".cd5" ) ) segmentFound = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
fileNames = new File( profileDir ).list();
|
|
||||||
ArrayList<String> profiles = new ArrayList<String>();
|
ArrayList<String> profiles = new ArrayList<String>();
|
||||||
|
|
||||||
boolean lookupsFound = false;
|
boolean lookupsFound = false;
|
||||||
|
@ -216,7 +204,7 @@ public class BRouterView extends View
|
||||||
+ " contains no routing profiles (*.brf)."
|
+ " contains no routing profiles (*.brf)."
|
||||||
+ " see www.dr-brenschede.de/brouter for setup instructions." );
|
+ " see www.dr-brenschede.de/brouter for setup instructions." );
|
||||||
}
|
}
|
||||||
if ( !segmentFound )
|
if ( !RoutingHelper.hasDirectoryAnyDatafiles( segmentDir ) )
|
||||||
{
|
{
|
||||||
((BRouterActivity)getContext()).startDownloadManager();
|
((BRouterActivity)getContext()).startDownloadManager();
|
||||||
waitingForSelection = true;
|
waitingForSelection = true;
|
||||||
|
@ -295,7 +283,6 @@ public class BRouterView extends View
|
||||||
String[] wpts = new String[allpoints.size()];
|
String[] wpts = new String[allpoints.size()];
|
||||||
int i = 0;
|
int i = 0;
|
||||||
for( OsmNodeNamed wp : allpoints.values() ) wpts[i++] = wp.name;
|
for( OsmNodeNamed wp : allpoints.values() ) wpts[i++] = wp.name;
|
||||||
System.out.println( "calling selectWaypoint..." );
|
|
||||||
((BRouterActivity)getContext()).selectWaypoint( wpts );
|
((BRouterActivity)getContext()).selectWaypoint( wpts );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -304,7 +291,6 @@ System.out.println( "calling selectWaypoint..." );
|
||||||
{
|
{
|
||||||
wpList.add( cor.allpoints.get( waypoint ) );
|
wpList.add( cor.allpoints.get( waypoint ) );
|
||||||
cor.allpoints.remove( waypoint );
|
cor.allpoints.remove( waypoint );
|
||||||
System.out.println( "updateWaypointList: " + waypoint + " wpList.size()=" + wpList.size() );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void finishWaypointSelection()
|
public void finishWaypointSelection()
|
||||||
|
@ -410,6 +396,7 @@ System.out.println( "updateWaypointList: " + waypoint + " wpList.size()=" + wpLi
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private void assertDirectoryExists( String message, String path, String assetZip )
|
private void assertDirectoryExists( String message, String path, String assetZip )
|
||||||
{
|
{
|
||||||
File f = new File( path );
|
File f = new File( path );
|
||||||
|
|
|
@ -2,12 +2,14 @@ package btools.routingapp;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
import java.util.Date;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
import android.os.Environment;
|
import android.os.Environment;
|
||||||
import btools.router.OsmNodeNamed;
|
import btools.router.OsmNodeNamed;
|
||||||
|
import btools.router.RoutingHelper;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Read coordinates from a gpx-file
|
* Read coordinates from a gpx-file
|
||||||
|
@ -96,7 +98,7 @@ public abstract class CoordinateReader
|
||||||
protected abstract void readPointmap() throws Exception;
|
protected abstract void readPointmap() throws Exception;
|
||||||
|
|
||||||
|
|
||||||
public static CoordinateReader obtainValidReader( String basedir ) throws Exception
|
public static CoordinateReader obtainValidReader( String basedir, String segmentDir ) throws Exception
|
||||||
{
|
{
|
||||||
CoordinateReader cor = null;
|
CoordinateReader cor = null;
|
||||||
ArrayList<CoordinateReader> rl = new ArrayList<CoordinateReader>();
|
ArrayList<CoordinateReader> rl = new ArrayList<CoordinateReader>();
|
||||||
|
@ -117,10 +119,32 @@ public abstract class CoordinateReader
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// eventually add explicit directory
|
||||||
|
File additional = RoutingHelper.getAdditionalMaptoolDir(segmentDir);
|
||||||
|
if ( additional != null )
|
||||||
|
{
|
||||||
|
String base3 = additional.getAbsolutePath();
|
||||||
|
|
||||||
|
AppLogger.log( "additional maptool-base from storage-config: " + base3 );
|
||||||
|
|
||||||
|
rl.add( new CoordinateReaderOsmAnd(base3) );
|
||||||
|
rl.add( new CoordinateReaderLocus(base3) );
|
||||||
|
rl.add( new CoordinateReaderOrux(base3) );
|
||||||
|
}
|
||||||
|
|
||||||
long tmax = 0;
|
long tmax = 0;
|
||||||
for( CoordinateReader r : rl )
|
for( CoordinateReader r : rl )
|
||||||
{
|
{
|
||||||
long t = r.getTimeStamp();
|
long t = r.getTimeStamp();
|
||||||
|
|
||||||
|
if ( t != 0 )
|
||||||
|
{
|
||||||
|
if ( AppLogger.isLogging() )
|
||||||
|
{
|
||||||
|
AppLogger.log( "found coordinate source at " + r.basedir + r.rootdir + " with timestamp " + new Date( t ) );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if ( t > tmax )
|
if ( t > tmax )
|
||||||
{
|
{
|
||||||
tmax = t;
|
tmax = t;
|
||||||
|
|
Loading…
Reference in a new issue