no waypoint sanity checks when just reading nogos

This commit is contained in:
Arndt 2016-12-07 21:54:50 +01:00
parent de5f70b9d9
commit 2f6309334f
2 changed files with 14 additions and 3 deletions

View file

@ -105,7 +105,7 @@ public class BRouterService extends Service
worker.profilePath = baseDir + "/brouter/profiles2/" + smc.profile + ".brf";
worker.rawTrackPath = baseDir + "/brouter/modes/" + mode_key + "_rawtrack.dat";
CoordinateReader cor = CoordinateReader.obtainValidReader( baseDir, worker.segmentDir );
CoordinateReader cor = CoordinateReader.obtainValidReader( baseDir, worker.segmentDir, true );
worker.nogoList = new ArrayList<OsmNodeNamed>();
// veto nogos by profiles veto list
for ( OsmNodeNamed nogo : cor.nogopoints )
@ -142,7 +142,7 @@ public class BRouterService extends Service
try
{
// add nogos from waypoint database
CoordinateReader cor = CoordinateReader.obtainValidReader( baseDir, worker.segmentDir );
CoordinateReader cor = CoordinateReader.obtainValidReader( baseDir, worker.segmentDir, true );
worker.nogoList = new ArrayList<OsmNodeNamed>( cor.nogopoints );
if ( !fileEqual( profileBytes, profileFile ) )

View file

@ -25,6 +25,8 @@ public abstract class CoordinateReader
public String rootdir;
public String tracksdir;
private boolean nogosOnly;
private Map<String,Map<String, OsmNodeNamed>> allpointsMap;
public List<OsmNodeNamed> allpoints;
@ -128,10 +130,13 @@ public abstract class CoordinateReader
if ( isKnown )
{
if ( pointmap.put( n.name, n ) != null )
{
if ( !nogosOnly )
{
throw new IllegalArgumentException( "multiple " + n.name + "-positions!" );
}
}
}
else if ( n.name != null && n.name.startsWith( "nogo" ) )
{
n.isNogo = true;
@ -144,6 +149,11 @@ public abstract class CoordinateReader
public static CoordinateReader obtainValidReader( String basedir, String segmentDir ) throws Exception
{
return obtainValidReader( basedir, segmentDir, false );
}
public static CoordinateReader obtainValidReader( String basedir, String segmentDir, boolean nogosOnly ) throws Exception
{
CoordinateReader cor = null;
ArrayList<CoordinateReader> rl = new ArrayList<CoordinateReader>();
@ -209,6 +219,7 @@ public abstract class CoordinateReader
{
cor = new CoordinateReaderNone();
}
cor.nogosOnly = nogosOnly;
cor.readFromTo();
return cor;
}