Merge pull request #313 from afischerdev/migrate-to-gradle
Migrate to gradle Part 2 This should run out of the box. But for Android you need a file 'local.properties' which is exclude in .gitignore See also new README I've tested it on a Window10 system and an Ubuntu under Windows - w/o Android
This commit is contained in:
commit
1066700c01
17 changed files with 334 additions and 225 deletions
15
README.md
15
README.md
|
@ -46,21 +46,26 @@ A full documentation on how to set this up is available at
|
||||||
|
|
||||||
### Build and Install
|
### Build and Install
|
||||||
|
|
||||||
To compile BRouter (including the BRouter Android app), use
|
To compile BRouter (including the BRouter Android app), add a file 'local.properties' to main folder with your Android path (Windows sample)
|
||||||
|
|
||||||
```
|
```
|
||||||
mvn clean install -Dandroid.sdk.path=<your-sdk-path>
|
sdk.dir=D\:\\Android\\android-sdk
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
and use
|
||||||
|
|
||||||
|
```
|
||||||
|
gradlew clean build
|
||||||
```
|
```
|
||||||
|
|
||||||
If you only want to compile BRouter and the server part (skipping the Android
|
If you only want to compile BRouter and the server part (skipping the Android
|
||||||
app), use
|
app), use
|
||||||
|
|
||||||
```
|
```
|
||||||
mvn clean install -pl '!brouter-routing-app'
|
gradlew clean build -x :brouter-routing-app:build
|
||||||
```
|
```
|
||||||
|
|
||||||
You can use `-Dmaven.javadoc.skip=true` to skip the JavaDoc processing and
|
|
||||||
`-DskipTests` to skip running the unitary tests.
|
|
||||||
|
|
||||||
|
|
||||||
### Get the required segments (data) files
|
### Get the required segments (data) files
|
||||||
|
|
|
@ -4,4 +4,5 @@ plugins {
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
implementation project(':brouter-util')
|
implementation project(':brouter-util')
|
||||||
|
testImplementation 'junit:junit:4.13.1'
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,5 +8,6 @@ dependencies {
|
||||||
implementation project(':brouter-util')
|
implementation project(':brouter-util')
|
||||||
implementation project(':brouter-expressions')
|
implementation project(':brouter-expressions')
|
||||||
implementation project(':brouter-codec')
|
implementation project(':brouter-codec')
|
||||||
|
testImplementation 'junit:junit:4.13.1'
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -711,6 +711,15 @@ public final class OsmTrack
|
||||||
|
|
||||||
public List<String> iternity;
|
public List<String> iternity;
|
||||||
|
|
||||||
|
public void writeJson( String filename ) throws Exception
|
||||||
|
{
|
||||||
|
BufferedWriter bw = new BufferedWriter( new FileWriter( filename ) );
|
||||||
|
|
||||||
|
bw.write( formatAsGeoJson() );
|
||||||
|
bw.close();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
public String formatAsGeoJson()
|
public String formatAsGeoJson()
|
||||||
{
|
{
|
||||||
int turnInstructionMode = voiceHints != null ? voiceHints.turnInstructionMode : 0;
|
int turnInstructionMode = voiceHints != null ? voiceHints.turnInstructionMode : 0;
|
||||||
|
|
|
@ -5,4 +5,5 @@ plugins {
|
||||||
dependencies {
|
dependencies {
|
||||||
implementation project(':brouter-util')
|
implementation project(':brouter-util')
|
||||||
implementation project(':brouter-codec')
|
implementation project(':brouter-codec')
|
||||||
|
testImplementation 'junit:junit:4.13.1'
|
||||||
}
|
}
|
||||||
|
|
|
@ -14,7 +14,7 @@ public class EncodeDecodeTest
|
||||||
{
|
{
|
||||||
URL testpurl = this.getClass().getResource( "/dummy.txt" );
|
URL testpurl = this.getClass().getResource( "/dummy.txt" );
|
||||||
File workingDir = new File(testpurl.getFile()).getParentFile();
|
File workingDir = new File(testpurl.getFile()).getParentFile();
|
||||||
File profileDir = new File( workingDir, "/../../../misc/profiles2" );
|
File profileDir = new File( workingDir, "/../../../../misc/profiles2" );
|
||||||
File lookupFile = new File( profileDir, "lookups.dat" );
|
File lookupFile = new File( profileDir, "lookups.dat" );
|
||||||
|
|
||||||
// read lookup.dat + trekking.brf
|
// read lookup.dat + trekking.brf
|
||||||
|
|
|
@ -2,15 +2,25 @@ plugins {
|
||||||
id 'application'
|
id 'application'
|
||||||
}
|
}
|
||||||
|
|
||||||
|
version = '1.6.1'
|
||||||
|
|
||||||
application {
|
application {
|
||||||
// Gradles 'application' plugin requires one main class; since we have multiple ones, just specify
|
// Gradles 'application' plugin requires one main class; since we have multiple ones, just specify
|
||||||
// one of them, since the applications won't be run from gradle anyways.
|
// one of them, since the applications won't be run from gradle anyways.
|
||||||
mainClassName = 'btools.mapcreator.PosUnifier'
|
mainClass.set('btools.mapcreator.PosUnifier')
|
||||||
|
|
||||||
|
jar {
|
||||||
|
manifest {
|
||||||
|
attributes "Main-Class": getMainClass()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
implementation project(':brouter-util')
|
|
||||||
implementation project(':brouter-codec')
|
implementation project(':brouter-codec')
|
||||||
|
implementation project(':brouter-util')
|
||||||
implementation project(':brouter-expressions')
|
implementation project(':brouter-expressions')
|
||||||
implementation('junit:junit:4.13')
|
|
||||||
|
testImplementation('junit:junit:4.13.1')
|
||||||
}
|
}
|
||||||
|
|
|
@ -17,7 +17,7 @@ public class MapcreatorTest
|
||||||
Assert.assertTrue( "test-osm-map dreieich.osm not found", mapurl != null );
|
Assert.assertTrue( "test-osm-map dreieich.osm not found", mapurl != null );
|
||||||
File mapFile = new File(mapurl.getFile());
|
File mapFile = new File(mapurl.getFile());
|
||||||
File workingDir = mapFile.getParentFile();
|
File workingDir = mapFile.getParentFile();
|
||||||
File profileDir = new File( workingDir, "/../../../misc/profiles2" );
|
File profileDir = new File( workingDir, "/../../../../misc/profiles2" );
|
||||||
File tmpdir = new File( workingDir, "tmp" );
|
File tmpdir = new File( workingDir, "tmp" );
|
||||||
tmpdir.mkdir();
|
tmpdir.mkdir();
|
||||||
|
|
||||||
|
|
|
@ -3,7 +3,6 @@ plugins {
|
||||||
}
|
}
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
implementation fileTree(dir: 'libs', include: ['*.jar'])
|
|
||||||
implementation project(':brouter-util')
|
implementation project(':brouter-util')
|
||||||
implementation project(':brouter-codec')
|
implementation project(':brouter-codec')
|
||||||
implementation project(':brouter-expressions')
|
implementation project(':brouter-expressions')
|
||||||
|
|
|
@ -3,32 +3,78 @@ plugins {
|
||||||
}
|
}
|
||||||
|
|
||||||
android {
|
android {
|
||||||
compileSdkVersion 29
|
compileSdkVersion 30
|
||||||
|
|
||||||
defaultConfig {
|
defaultConfig {
|
||||||
applicationId "btools.routingapp"
|
applicationId "btools.routingapp"
|
||||||
minSdkVersion 10
|
minSdkVersion 19
|
||||||
targetSdkVersion 29
|
targetSdkVersion 30
|
||||||
versionCode 41
|
versionCode 41
|
||||||
versionName "1.6.1"
|
versionName "1.6.1"
|
||||||
|
|
||||||
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
setProperty("archivesBaseName","BRouterApp." + defaultConfig.versionName)
|
||||||
|
|
||||||
|
//testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(project.hasProperty("RELEASE_STORE_FILE")) {
|
||||||
|
signingConfigs {
|
||||||
|
// this uses a file ~/.gradle/gradle.properties
|
||||||
|
// with content:
|
||||||
|
// RELEASE_STORE_FILE={path to your keystore}
|
||||||
|
// RELEASE_STORE_PASSWORD=*****
|
||||||
|
// RELEASE_KEY_ALIAS=*****
|
||||||
|
// RELEASE_KEY_PASSWORD=*****
|
||||||
|
//
|
||||||
|
release {
|
||||||
|
// enable signingConfig in buildTypes to get a signed apk file
|
||||||
|
storeFile file(RELEASE_STORE_FILE)
|
||||||
|
storePassword RELEASE_STORE_PASSWORD
|
||||||
|
keyAlias RELEASE_KEY_ALIAS
|
||||||
|
keyPassword RELEASE_KEY_PASSWORD
|
||||||
|
|
||||||
|
// Optional, specify signing versions used
|
||||||
|
v1SigningEnabled true
|
||||||
|
v2SigningEnabled true
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
buildTypes {
|
buildTypes {
|
||||||
release {
|
release {
|
||||||
minifyEnabled false
|
minifyEnabled false
|
||||||
|
debuggable false
|
||||||
|
if(project.hasProperty("RELEASE_STORE_FILE")) {
|
||||||
|
signingConfig signingConfigs.release
|
||||||
|
}
|
||||||
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
|
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
|
||||||
}
|
}
|
||||||
|
debug {
|
||||||
|
minifyEnabled false
|
||||||
|
debuggable true
|
||||||
|
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
lintOptions {
|
||||||
|
disable 'InvalidPackage'
|
||||||
|
checkReleaseBuilds false //added this line to the build.gradle under the /android/app/build.gradle
|
||||||
|
}
|
||||||
|
|
||||||
|
compileOptions {
|
||||||
|
sourceCompatibility JavaVersion.VERSION_1_8
|
||||||
|
targetCompatibility JavaVersion.VERSION_1_8
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
implementation fileTree(dir: 'libs', include: ['*.jar'])
|
|
||||||
|
implementation 'androidx.appcompat:appcompat:1.3.0'
|
||||||
|
|
||||||
implementation project(':brouter-mapaccess')
|
implementation project(':brouter-mapaccess')
|
||||||
implementation project(':brouter-core')
|
implementation project(':brouter-core')
|
||||||
implementation project(':brouter-expressions')
|
implementation project(':brouter-expressions')
|
||||||
implementation project(':brouter-util')
|
implementation project(':brouter-util')
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,195 +1,230 @@
|
||||||
package btools.routingapp;
|
package btools.routingapp;
|
||||||
|
|
||||||
|
|
||||||
import java.io.BufferedWriter;
|
import java.io.BufferedWriter;
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.FileWriter;
|
import java.io.FileWriter;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.HashMap;
|
||||||
|
import java.util.List;
|
||||||
import android.os.Bundle;
|
import java.util.StringTokenizer;
|
||||||
import btools.router.OsmNodeNamed;
|
|
||||||
import btools.router.OsmPathElement;
|
import android.os.Bundle;
|
||||||
import btools.router.OsmTrack;
|
import btools.router.OsmNodeNamed;
|
||||||
import btools.router.RoutingContext;
|
import btools.router.OsmPathElement;
|
||||||
import btools.router.RoutingEngine;
|
import btools.router.OsmTrack;
|
||||||
|
import btools.router.RoutingContext;
|
||||||
public class BRouterWorker
|
import btools.router.RoutingEngine;
|
||||||
{
|
|
||||||
public String baseDir;
|
public class BRouterWorker
|
||||||
public String segmentDir;
|
{
|
||||||
public String profileName;
|
private static final int OUTPUT_FORMAT_GPX = 0;
|
||||||
public String profilePath;
|
private static final int OUTPUT_FORMAT_KML = 1;
|
||||||
public String rawTrackPath;
|
private static final int OUTPUT_FORMAT_JSON = 2;
|
||||||
public List<OsmNodeNamed> waypoints;
|
|
||||||
public List<OsmNodeNamed> nogoList;
|
public String baseDir;
|
||||||
|
public String segmentDir;
|
||||||
public String getTrackFromParams(Bundle params)
|
public String profileName;
|
||||||
{
|
public String profilePath;
|
||||||
String pathToFileResult = params.getString("pathToFileResult");
|
public String rawTrackPath;
|
||||||
|
public List<OsmNodeNamed> waypoints;
|
||||||
if (pathToFileResult != null)
|
public List<OsmNodeNamed> nogoList;
|
||||||
{
|
|
||||||
File f = new File (pathToFileResult);
|
public String getTrackFromParams(Bundle params)
|
||||||
File dir = f.getParentFile();
|
{
|
||||||
if (!dir.exists() || !dir.canWrite()){
|
String pathToFileResult = params.getString("pathToFileResult");
|
||||||
return "file folder does not exists or can not be written!";
|
|
||||||
}
|
if (pathToFileResult != null)
|
||||||
}
|
{
|
||||||
|
File f = new File (pathToFileResult);
|
||||||
long maxRunningTime = 60000;
|
File dir = f.getParentFile();
|
||||||
String sMaxRunningTime = params.getString( "maxRunningTime" );
|
if (!dir.exists() || !dir.canWrite()){
|
||||||
if ( sMaxRunningTime != null )
|
return "file folder does not exists or can not be written!";
|
||||||
{
|
}
|
||||||
maxRunningTime = Integer.parseInt( sMaxRunningTime ) * 1000;
|
}
|
||||||
}
|
|
||||||
|
long maxRunningTime = 60000;
|
||||||
RoutingContext rc = new RoutingContext();
|
String sMaxRunningTime = params.getString( "maxRunningTime" );
|
||||||
rc.rawTrackPath = rawTrackPath;
|
if ( sMaxRunningTime != null )
|
||||||
rc.localFunction = profilePath;
|
{
|
||||||
|
maxRunningTime = Integer.parseInt( sMaxRunningTime ) * 1000;
|
||||||
String tiFormat = params.getString( "turnInstructionFormat" );
|
}
|
||||||
if ( tiFormat != null )
|
|
||||||
{
|
RoutingContext rc = new RoutingContext();
|
||||||
if ( "osmand".equalsIgnoreCase( tiFormat ) )
|
rc.rawTrackPath = rawTrackPath;
|
||||||
{
|
rc.localFunction = profilePath;
|
||||||
rc.turnInstructionMode = 3;
|
|
||||||
}
|
String tiFormat = params.getString( "turnInstructionFormat" );
|
||||||
else if ( "locus".equalsIgnoreCase( tiFormat ) )
|
if ( tiFormat != null )
|
||||||
{
|
{
|
||||||
rc.turnInstructionMode = 2;
|
if ( "osmand".equalsIgnoreCase( tiFormat ) )
|
||||||
}
|
{
|
||||||
}
|
rc.turnInstructionMode = 3;
|
||||||
|
}
|
||||||
if ( params.containsKey( "direction" ) )
|
else if ( "locus".equalsIgnoreCase( tiFormat ) )
|
||||||
{
|
{
|
||||||
rc.startDirection = Integer.valueOf( params.getInt( "direction" ) );
|
rc.turnInstructionMode = 2;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
readNogos( params ); // add interface provided nogos
|
|
||||||
RoutingContext.prepareNogoPoints( nogoList );
|
if ( params.containsKey( "direction" ) )
|
||||||
rc.nogopoints = nogoList;
|
{
|
||||||
|
rc.startDirection = Integer.valueOf( params.getInt( "direction" ) );
|
||||||
waypoints = readPositions(params);
|
}
|
||||||
|
if (params.containsKey( "extraParams" )) { // add user params
|
||||||
try
|
String extraParams = params.getString("extraParams");
|
||||||
{
|
if (rc.keyValues == null) rc.keyValues = new HashMap<String,String>();
|
||||||
writeTimeoutData( rc );
|
StringTokenizer tk = new StringTokenizer( extraParams, "?&" );
|
||||||
}
|
while( tk.hasMoreTokens() ) {
|
||||||
catch( Exception e ) {}
|
String t = tk.nextToken();
|
||||||
|
StringTokenizer tk2 = new StringTokenizer( t, "=" );
|
||||||
RoutingEngine cr = new RoutingEngine( null, null, segmentDir, waypoints, rc );
|
if ( tk2.hasMoreTokens() ) {
|
||||||
cr.quite = true;
|
String key = tk2.nextToken();
|
||||||
cr.doRun( maxRunningTime );
|
if ( tk2.hasMoreTokens() ) {
|
||||||
|
String value = tk2.nextToken();
|
||||||
// store new reference track if any
|
rc.keyValues.put( key, value );
|
||||||
// (can exist for timed-out search)
|
}
|
||||||
if ( cr.getFoundRawTrack() != null )
|
}
|
||||||
{
|
}
|
||||||
try
|
}
|
||||||
{
|
|
||||||
cr.getFoundRawTrack().writeBinary( rawTrackPath );
|
readNogos( params ); // add interface provided nogos
|
||||||
}
|
RoutingContext.prepareNogoPoints( nogoList );
|
||||||
catch( Exception e ) {}
|
rc.nogopoints = nogoList;
|
||||||
}
|
|
||||||
|
waypoints = readPositions(params);
|
||||||
if ( cr.getErrorMessage() != null )
|
|
||||||
{
|
try
|
||||||
return cr.getErrorMessage();
|
{
|
||||||
}
|
writeTimeoutData( rc );
|
||||||
|
}
|
||||||
String format = params.getString("trackFormat");
|
catch( Exception e ) {}
|
||||||
boolean writeKml = format != null && "kml".equals( format );
|
|
||||||
|
RoutingEngine cr = new RoutingEngine( null, null, segmentDir, waypoints, rc );
|
||||||
OsmTrack track = cr.getFoundTrack();
|
cr.quite = true;
|
||||||
if ( track != null )
|
cr.doRun( maxRunningTime );
|
||||||
{
|
|
||||||
if ( pathToFileResult == null )
|
// store new reference track if any
|
||||||
{
|
// (can exist for timed-out search)
|
||||||
if ( writeKml ) return track.formatAsKml();
|
if ( cr.getFoundRawTrack() != null )
|
||||||
return track.formatAsGpx();
|
{
|
||||||
}
|
try
|
||||||
try
|
{
|
||||||
{
|
cr.getFoundRawTrack().writeBinary( rawTrackPath );
|
||||||
if ( writeKml ) track.writeKml(pathToFileResult);
|
}
|
||||||
else track.writeGpx(pathToFileResult);
|
catch( Exception e ) {}
|
||||||
}
|
}
|
||||||
catch( Exception e )
|
|
||||||
{
|
if ( cr.getErrorMessage() != null )
|
||||||
return "error writing file: " + e;
|
{
|
||||||
}
|
return cr.getErrorMessage();
|
||||||
}
|
}
|
||||||
return null;
|
|
||||||
}
|
String format = params.getString("trackFormat");
|
||||||
|
int writeFromat = OUTPUT_FORMAT_GPX;
|
||||||
private List<OsmNodeNamed> readPositions( Bundle params )
|
if (format != null) {
|
||||||
{
|
if ("kml".equals(format)) writeFromat = OUTPUT_FORMAT_KML;
|
||||||
List<OsmNodeNamed> wplist = new ArrayList<OsmNodeNamed>();
|
if ("json".equals(format)) writeFromat = OUTPUT_FORMAT_JSON;
|
||||||
|
}
|
||||||
double[] lats = params.getDoubleArray("lats");
|
|
||||||
double[] lons = params.getDoubleArray("lons");
|
OsmTrack track = cr.getFoundTrack();
|
||||||
|
if ( track != null )
|
||||||
if (lats == null || lats.length < 2 || lons == null || lons.length < 2)
|
{
|
||||||
{
|
if ( pathToFileResult == null )
|
||||||
throw new IllegalArgumentException( "we need two lat/lon points at least!" );
|
{
|
||||||
}
|
switch ( writeFromat ) {
|
||||||
|
case OUTPUT_FORMAT_GPX: return track.formatAsGpx();
|
||||||
for( int i=0; i<lats.length && i<lons.length; i++ )
|
case OUTPUT_FORMAT_KML: return track.formatAsKml();
|
||||||
{
|
case OUTPUT_FORMAT_JSON: return track.formatAsGeoJson();
|
||||||
OsmNodeNamed n = new OsmNodeNamed();
|
default: return track.formatAsGpx();
|
||||||
n.name = "via" + i;
|
}
|
||||||
n.ilon = (int)( ( lons[i] + 180. ) *1000000. + 0.5);
|
|
||||||
n.ilat = (int)( ( lats[i] + 90. ) *1000000. + 0.5);
|
}
|
||||||
wplist.add( n );
|
try
|
||||||
}
|
{
|
||||||
wplist.get(0).name = "from";
|
switch ( writeFromat ) {
|
||||||
wplist.get(wplist.size()-1).name = "to";
|
case OUTPUT_FORMAT_GPX: track.writeGpx(pathToFileResult); break;
|
||||||
|
case OUTPUT_FORMAT_KML: track.writeKml(pathToFileResult); break;
|
||||||
return wplist;
|
case OUTPUT_FORMAT_JSON: track.writeJson(pathToFileResult); break;
|
||||||
}
|
default: track.writeGpx(pathToFileResult); break;
|
||||||
|
}
|
||||||
private void readNogos( Bundle params )
|
}
|
||||||
{
|
catch( Exception e )
|
||||||
double[] lats = params.getDoubleArray("nogoLats");
|
{
|
||||||
double[] lons = params.getDoubleArray("nogoLons");
|
return "error writing file: " + e;
|
||||||
double[] radi = params.getDoubleArray("nogoRadi");
|
}
|
||||||
|
}
|
||||||
if ( lats == null || lons == null || radi == null ) return;
|
return null;
|
||||||
|
}
|
||||||
for( int i=0; i<lats.length && i<lons.length && i<radi.length; i++ )
|
|
||||||
{
|
private List<OsmNodeNamed> readPositions( Bundle params )
|
||||||
OsmNodeNamed n = new OsmNodeNamed();
|
{
|
||||||
n.name = "nogo" + (int)radi[i];
|
List<OsmNodeNamed> wplist = new ArrayList<OsmNodeNamed>();
|
||||||
n.ilon = (int)( ( lons[i] + 180. ) *1000000. + 0.5);
|
|
||||||
n.ilat = (int)( ( lats[i] + 90. ) *1000000. + 0.5);
|
double[] lats = params.getDoubleArray("lats");
|
||||||
n.isNogo = true;
|
double[] lons = params.getDoubleArray("lons");
|
||||||
n.nogoWeight = Double.NaN;
|
|
||||||
AppLogger.log( "added interface provided nogo: " + n );
|
if (lats == null || lats.length < 2 || lons == null || lons.length < 2)
|
||||||
nogoList.add( n );
|
{
|
||||||
}
|
throw new IllegalArgumentException( "we need two lat/lon points at least!" );
|
||||||
}
|
}
|
||||||
|
|
||||||
private void writeTimeoutData( RoutingContext rc ) throws Exception
|
for( int i=0; i<lats.length && i<lons.length; i++ )
|
||||||
{
|
{
|
||||||
String timeoutFile = baseDir + "/brouter/modes/timeoutdata.txt";
|
OsmNodeNamed n = new OsmNodeNamed();
|
||||||
|
n.name = "via" + i;
|
||||||
BufferedWriter bw = new BufferedWriter( new FileWriter( timeoutFile ) );
|
n.ilon = (int)( ( lons[i] + 180. ) *1000000. + 0.5);
|
||||||
bw.write( profileName );
|
n.ilat = (int)( ( lats[i] + 90. ) *1000000. + 0.5);
|
||||||
bw.write( "\n" );
|
wplist.add( n );
|
||||||
bw.write( rc.rawTrackPath );
|
}
|
||||||
bw.write( "\n" );
|
wplist.get(0).name = "from";
|
||||||
writeWPList( bw, waypoints );
|
wplist.get(wplist.size()-1).name = "to";
|
||||||
writeWPList( bw, nogoList );
|
|
||||||
bw.close();
|
return wplist;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void writeWPList( BufferedWriter bw, List<OsmNodeNamed> wps ) throws Exception
|
private void readNogos( Bundle params )
|
||||||
{
|
{
|
||||||
bw.write( wps.size() + "\n" );
|
double[] lats = params.getDoubleArray("nogoLats");
|
||||||
for( OsmNodeNamed wp : wps )
|
double[] lons = params.getDoubleArray("nogoLons");
|
||||||
{
|
double[] radi = params.getDoubleArray("nogoRadi");
|
||||||
bw.write( wp.toString() );
|
|
||||||
bw.write( "\n" );
|
if ( lats == null || lons == null || radi == null ) return;
|
||||||
}
|
|
||||||
}
|
for( int i=0; i<lats.length && i<lons.length && i<radi.length; i++ )
|
||||||
}
|
{
|
||||||
|
OsmNodeNamed n = new OsmNodeNamed();
|
||||||
|
n.name = "nogo" + (int)radi[i];
|
||||||
|
n.ilon = (int)( ( lons[i] + 180. ) *1000000. + 0.5);
|
||||||
|
n.ilat = (int)( ( lats[i] + 90. ) *1000000. + 0.5);
|
||||||
|
n.isNogo = true;
|
||||||
|
n.nogoWeight = Double.NaN;
|
||||||
|
AppLogger.log( "added interface provided nogo: " + n );
|
||||||
|
nogoList.add( n );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void writeTimeoutData( RoutingContext rc ) throws Exception
|
||||||
|
{
|
||||||
|
String timeoutFile = baseDir + "/brouter/modes/timeoutdata.txt";
|
||||||
|
|
||||||
|
BufferedWriter bw = new BufferedWriter( new FileWriter( timeoutFile ) );
|
||||||
|
bw.write( profileName );
|
||||||
|
bw.write( "\n" );
|
||||||
|
bw.write( rc.rawTrackPath );
|
||||||
|
bw.write( "\n" );
|
||||||
|
writeWPList( bw, waypoints );
|
||||||
|
writeWPList( bw, nogoList );
|
||||||
|
bw.close();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void writeWPList( BufferedWriter bw, List<OsmNodeNamed> wps ) throws Exception
|
||||||
|
{
|
||||||
|
bw.write( wps.size() + "\n" );
|
||||||
|
for( OsmNodeNamed wp : wps )
|
||||||
|
{
|
||||||
|
bw.write( wp.toString() );
|
||||||
|
bw.write( "\n" );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -2,19 +2,23 @@ plugins {
|
||||||
id 'application'
|
id 'application'
|
||||||
}
|
}
|
||||||
|
|
||||||
|
version = '1.6.1'
|
||||||
|
|
||||||
application {
|
application {
|
||||||
mainClassName = 'btools.server.BRouter'
|
mainClass.set('btools.server.BRouter')
|
||||||
|
|
||||||
jar {
|
jar {
|
||||||
manifest {
|
manifest {
|
||||||
attributes "Main-Class": "$mainClassName"
|
attributes "Main-Class": getMainClass()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
implementation('junit:junit:4.13')
|
testImplementation 'junit:junit:4.13.1'
|
||||||
|
|
||||||
implementation project(':brouter-util')
|
implementation project(':brouter-util')
|
||||||
implementation project(':brouter-core')
|
implementation project(':brouter-core')
|
||||||
implementation project(':brouter-mapaccess')
|
implementation project(':brouter-mapaccess')
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -20,7 +20,7 @@ public class IntegrityCheckTest
|
||||||
File resultfile = new File( resulturl.getFile() );
|
File resultfile = new File( resulturl.getFile() );
|
||||||
workingDir = resultfile.getParentFile();
|
workingDir = resultfile.getParentFile();
|
||||||
|
|
||||||
File segmentDir = new File( workingDir, "/../../../brouter-map-creator/target/test-classes/tmp/segments" );
|
File segmentDir = new File( workingDir, "/../../../../brouter-map-creator/build/resources/test/tmp/segments" );
|
||||||
File[] files = segmentDir.listFiles();
|
File[] files = segmentDir.listFiles();
|
||||||
|
|
||||||
for ( File f : files )
|
for ( File f : files )
|
||||||
|
|
|
@ -61,13 +61,13 @@ public class RouterTest
|
||||||
wplist.add( n );
|
wplist.add( n );
|
||||||
|
|
||||||
RoutingContext rctx = new RoutingContext();
|
RoutingContext rctx = new RoutingContext();
|
||||||
rctx.localFunction = wd + "/../../../misc/profiles2/trekking.brf";
|
rctx.localFunction = wd + "/../../../../misc/profiles2/trekking.brf";
|
||||||
// c.setAlternativeIdx( 1 );
|
// c.setAlternativeIdx( 1 );
|
||||||
|
|
||||||
RoutingEngine re = new RoutingEngine(
|
RoutingEngine re = new RoutingEngine(
|
||||||
wd + "/" + trackname,
|
wd + "/" + trackname,
|
||||||
wd + "/" + trackname,
|
wd + "/" + trackname,
|
||||||
wd + "/../../../brouter-map-creator/target/test-classes/tmp/segments", wplist, rctx );
|
wd + "/../../../../brouter-map-creator/build/resources/test/tmp/segments", wplist, rctx );
|
||||||
re.doRun( 0 );
|
re.doRun( 0 );
|
||||||
|
|
||||||
return re.getErrorMessage();
|
return re.getErrorMessage();
|
||||||
|
|
|
@ -3,5 +3,5 @@ plugins {
|
||||||
}
|
}
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
implementation fileTree(dir: 'libs', include: ['*.jar'])
|
testImplementation('junit:junit:4.13.1')
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,12 +3,11 @@
|
||||||
buildscript {
|
buildscript {
|
||||||
|
|
||||||
repositories {
|
repositories {
|
||||||
|
mavenCentral()
|
||||||
google()
|
google()
|
||||||
jcenter()
|
|
||||||
|
|
||||||
}
|
}
|
||||||
dependencies {
|
dependencies {
|
||||||
classpath 'com.android.tools.build:gradle:3.6.3'
|
classpath 'com.android.tools.build:gradle:4.1.3'
|
||||||
|
|
||||||
|
|
||||||
// NOTE: Do not place your application dependencies here; they belong
|
// NOTE: Do not place your application dependencies here; they belong
|
||||||
|
@ -18,9 +17,8 @@ buildscript {
|
||||||
|
|
||||||
allprojects {
|
allprojects {
|
||||||
repositories {
|
repositories {
|
||||||
|
mavenCentral()
|
||||||
google()
|
google()
|
||||||
jcenter()
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
2
gradle/wrapper/gradle-wrapper.properties
vendored
2
gradle/wrapper/gradle-wrapper.properties
vendored
|
@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME
|
||||||
distributionPath=wrapper/dists
|
distributionPath=wrapper/dists
|
||||||
zipStoreBase=GRADLE_USER_HOME
|
zipStoreBase=GRADLE_USER_HOME
|
||||||
zipStorePath=wrapper/dists
|
zipStorePath=wrapper/dists
|
||||||
distributionUrl=https\://services.gradle.org/distributions/gradle-5.6.4-all.zip
|
distributionUrl=https\://services.gradle.org/distributions/gradle-7.0-all.zip
|
||||||
|
|
Loading…
Reference in a new issue